Someone tell me what’s wrong with my code…

#include <bits/stdc++.h>

using namespace std;

int main() {

int t;

cin>>t;

while(t–)

{

int n,k,i,arr[1000000];

cin>>n,k;

for( i=1;i<=k;i++)

{

arr[i]=i;

}

arr[k+1]=n;

for( i=k+2;i<=n;i++)

{

arr[i]=i-1;

}

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

{

cout<<arr[i]<<" ";

}

cout<<endl;

}

// your code goes here

return 0;

}