Help me in solving AMMEAT problem

My issue

WA error

My code

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	// your code goes here
	int t; cin >> t;
	while(t--)
	{
	    int n,x; 
	    cin >> n >> x; 
	    vector<int> arr(n);
	    for(int i = 0; i <n; i++){cin >> arr[i];}
	    sort(arr.rbegin(), arr.rend()); 
	    
	    int sum = 0, index = 0; 
	    for(int i = 0; i <n; i++){
            sum += arr[i];
            index++; 
            if (sum >= x){
                break; 
            }
	    }
	    if(sum < x){
	        cout << -1; 
	    }
	    else{
	        cout << index; 
	    }
	    
	    cout << endl; 
	}
	return 0;
}

Learning course: Sorting using C++
Problem Link: CodeChef: Practical coding for everyone

@judelhuu
U have to use long long int instead of int bcozz of high constraints .
Rest of your code is correct.

Thanks