#include#include using namespace std; typedef pair PII; const int N = 100; PII a[N]; int main() { int T;cin>>T; while(T--) { int n,m;cin>>n>>m; queue q; priority_queue Q; for(int i=0;i >a[i].first; a[i].second=i; q.push(a[i]); Q.push(a[i].first); } int ans=0; while(1) { PII t=q.front();q.pop(); if(t.first==Q.top()) { Q.pop(); ans++; if(t.second==m) break; } else q.push(t); } cout<



