#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
long long n, x, minim = 2000000000;
long long a[N];
long long sum;
int main() {
  cin >> n >> x;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] < minim) minim = a[i];
  }
  for (int i = 1; i <= n; ++i) a[i] -= minim;
  sum = n * minim * 1LL;
  while (a[x]) {
    ++sum;
    --a[x];
    if (x == 1)
      x = n;
    else
      x--;
  }
  for (int i = 1; i <= n; ++i)
    if (i == x)
      cout << sum << ' ';
    else
      cout << a[i] << ' ';
}
