#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
int main()
{
int a;
scanf("%d",&a);
for(int i=0; i<a; i++)
{
int n,m;
scanf("%d %d",&n,&m);
int mwl=m;
queue<int> q;
int order[105]={};
for(int j=0; j<n; j++)
{
int pt;
scanf("%d",&pt);
order[j]=pt;
q.push(pt);
}
sort(order,order+n);
int op=0;
int t=0;
while(!q.empty())
{
if(q.front()<order[op])
{
q.push(q.front());
q.pop();
}
else
{
t++;
q.pop();
op++;
}
}
printf("%d\n",t);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: