#include<iostream>
using namespace std;
int main()
{
int n,m,b;
cin>>n;
int a[n], x[1000];
for(b=0;b<n;b++)
cin>>a[b];
cin>>m;
for(b=0;b<(n-m);b++)
x[b+m]=a[b];
for(b=(n-m);b<n;b++)
x[b-(n-m)]=a[b];
for(b=0;b<n;b++)
cout<<x[b]<<" ";
return 0;
}
using namespace std;
int main()
{
int n,m,b;
cin>>n;
int a[n], x[1000];
for(b=0;b<n;b++)
cin>>a[b];
cin>>m;
for(b=0;b<(n-m);b++)
x[b+m]=a[b];
for(b=(n-m);b<n;b++)
x[b-(n-m)]=a[b];
for(b=0;b<n;b++)
cout<<x[b]<<" ";
return 0;
}