代码:
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a[105];
int main()
{
int n,m;
int i,j;
while(scanf("%d%d",&n,&m)==2)
{
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int r=m%n;
if(r==0)
{
for(i=0;i<n;i++)
{
if(i==0)
{
printf("%d",a[i]);
}
else
printf(" %d",a[i]);
}
printf("\n");
continue;
}
int start=n-r;
int end=n-r-1;
for(i=start;i<n;i++)
{
if(i==start)
{
printf("%d",a[i]);
}
else
printf(" %d",a[i]);
}
if(end>=0)
{
for(i=0;i<=end;i++)
{
printf(" %d",a[i]);
}
}
printf("\n");
}
}