- Note that the value of m may be greater than n
#include <iostream>
#include <math.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
int array[n];
for (int i=0;i<n;i++){
scanf("%d",&array[i]);
}
m %=n ;
for (int i=n-m;i<n;i++){
printf("%d",array[i]);
printf(" ");
}
for (int i=0;i<n-m;i++){
if(i!=0)printf(" ");
printf("%d",array[i]);
}
}