public class Main {
public static void main(String args[]) throws IOException {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int k=sc.nextInt();
int[] arr=new int[n];
for(int i=0;i<n;i++){
arr[i]=sc.nextInt();
}
rotation(0,n-k-1,arr);
rotation(n-k,n-1,arr);
// rotation(0,n-1,arr);
int temp;
for(int i=n-1,j=0;j<i;i--,j++)
{
temp=arr[j];
arr[j]=arr[i];
arr[i]=temp;
}
// for(int i=0;i<n;i++){
// System.out.print(arr[i]);
// System.out.print(" ");
// }
System.out.println(Arrays.toString(arr));
}
}
public static void rotation(int start,int end,int[] arr)
{
int temp;
for(int i=end,j=start;j<i;i--,j++)
{
temp=arr[start];
arr[start]=arr[end];
arr[end]=temp;
}
}
}
These are the constraints to be taken care of 1<=T<=20
1<=N<=10^5
0<=K<=10^6
0<=A[i]<=10^6
Input Format: The first line contains an integer T denoting the number of test cases. Each test case consists of two lines. The first line contains N , number of elements in the array and K number of steps. The Second line contains N space-separated integers.
Output Format:For each test case on a new line, print the rotated array.