include[HTML_REMOVED]
using namespace std;
void reverse(int a[], int size,int n)
{
for(int i=size;i>=1;i--)
{
cout << a[i] << " ";
}
for(int i=size+1;i<=n;i++)
{
cout << a[i] << " ";
}
}
int main()
{
int n,size;
cin >> n >> size;
int a[n+1]={0};
for(int i=1;i<=n;i++)
{
cin >> a[i];
}
reverse(a,size,n);
return 0;
}