paying up(wrong answer)

#include
#include
int main()
{
int x,sum,flag=0;
unsigned int t;
scanf("%u",&t);
int nonotes,money,d[20];
for(unsigned int k=1;k<=t;k++)
{
fflush(stdin);
scanf("%d%d",&nonotes,&money);
for(int i=0;i<nonotes;i++)
scanf("%d",&d[i]);
sum=0;
for(int i=1;i<pow(2,nonotes);i++)
{
sum=0;

	x=i;
	for(int j=0;j<nonotes;j++)
	{
		if(x&1==1)
		{
		sum=sum+d[j];
		if(sum==money)
		{
		flag=1;
		break;
	    }
		
	    }
	    x=x>>1;
    }
    if(sum==money)
		{
		printf("\nYes");
		flag=1;
		break;
	    }
	
	
}
if(flag==0)
printf("\nNo");
}

}

bt still getting wrong answer…can nybdy help