paying up! getting wrong answer,what is the error in my code?

#include<stdio.h>
int main ()
{
int m , i , t , n , a[22] , j,temp ;
scanf ("%d",&t) ;

    while (t--)
    {

        scanf ("%d %d",&n , &m) ;
        if((n < 21) && (m<=20000))
        {


        for (i = 0 ; i<n ; i ++)
            scanf ("%d",&a[i]) ;
//sorting//
         for(i=0;i<(n-1);i++)
        {
            for(j=0;j<=(n-i-1);j++)
            {
                if(a[j]>a[j+1])
                {
                    temp=a[j];
                    a[j]=a[j+1];
                    a[j+1]=temp;
                }

            }
        }

        {
            for (i = n ; i>=0 ; i--)
            {
                if (a[i] <= m)
                {
                    m = m - a[i] ;
                    if (m == 0 )
                        break;
                }
            }
        }

        if (m == 0 )
            printf ("Yes\n")  ;
        else
            printf ("No\n")  ;
    }
    }
return 0 ;
}

The constraint section nowhere mentioned that m<=20000. The setter might test for m>20000 for which we have to print “No”.

Also, you seem to be using greedy approach here, which can be proved wrong.

Here-

Input
1
4 4
3
2
2
2
Your Output
No
Expected Output
Yes (We can take two notes of '2' and pay him 4)