Help me in solving DIET problem

My issue

My code

#include <stdio.h>

int main(void) {
	int t;
	scanf("%d", &t);
	while(t--)
	{
	    int n,k,count=0;
	    scanf("%d%d", &n,&k);
	    int a[n],i;
	    for(i=0;i<n;i++)
	    {
	        scanf("%d", &a[i]);
	    }
	    int sum=0;
	    for(i=0;i<n;i++)
	    {
	        
	        if(sum+a[i]>=k)
	        {
	            sum=sum+a[i]-k;
	            count++;
	        }
	        else
	        {
	           printf("no %d\n", i+1);
	           break;
	        }
	    }
	    
	    if(count==n && sum>=0)
	    {
	        printf("yes\n");
	    }
	    
	}
}


Problem Link: DIET Problem - CodeChef

@dharani80
U have to print yes and no like “YES” and “NO” .