You need to think your algorithm through carefully instead of just throwing code around.
int b[100],c[100];
The values of b are uninitialized at this point. They might be zero, they might be 10000.
int p=0;
for(l=0;l<100;l++)
{
if(b[l]>0)
{
p++;
break;
}
}
Since the values of b are uninitialized, if k is not equal to 100 your value of p is unreliable.
if(p==0)
printf("-1\n");
else
Since your value of p is no reliable there are likely many instances where you should print -1 that you do not.