using namespace std;

int main() {

// your code goes here

int t,n,i;

long x,a,mini,infec;

cin >> t;

while(t>=1)

{

cin >> n >> x;

vector days;

for(i=0;i<n;i++)

{

cin >> a;

days.push_back(a);

}

sort(days.begin(),days.end(),greater());

infec = days[0]; //infec variable contains max population amongst countries

mini =0;

/*

In this algo what I am doing is I am running a while loop to increase the value of x until it becomes greter than the

total no of people infected in country with max population. I am decreasing the value of infec when 2*x>infec

```
while increasing the value of x if it becomes greter than the population of other countries than i am increasing value of days and
removing that country from list.
my test cases are running fine.
*/
while(!days.empty() && x<infec)
{
if(x>=days.back() && (2*days.back())>x)
{
mini++;
x = days.back()*2;
days.pop_back();
//cout << mini <<endl;
continue;
}
else
{
mini++;
x = x*2;
if(infec<2*x)
{
infec = infec - x;
infec = 2*infec;
//x = x*2;
}
}
//cout << x <<endl;
}
if(x>=infec && !days.empty())
{
while(!days.empty())
{
days.pop_back();
mini++;
}
}
cout << mini <<endl;
t--;
}
return 0;
```

}

please sir can u check my code