Dinosaurs Football--MXCH

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;
}

1
5 1

Your code gives output :

5 1 2 3 4

It would be :

1 5 2 3 4

ohh yes…got it now…Thanks for replying
but the code is right yaa…it should give 1 5 2 3 4…why its giving 5 1 2 3 4

its giving the same output in all the cases…but howcome ???