WRONG ANSWER

#include<stdio.h>
int main()
{
int t,a,i;
int b,temp,count;
scanf("%d",&t);
while(t–)
{
count=0;
scanf("%d%d",&a,&b);
for(i=0;i<a;i++)
{
scanf("%d",&temp);
count+=temp;

    }
    if(count<=b)
    {
        printf("YES\n");
    }
    else
        {
            printf("NO\n");
        }
}
return 0;

}

You are using short int data type. In case of short int, the format specifier for scanf is “%hd”.

Replace

scanf("%d%d",&a,&b);

with this

scanf("%hd %d",&a,&b);

For more information about scanf format specifier refer to this article.