#include <bits/stdc++.h>
using namespace std;
long long n, x, a[100005], mx = INT_MAX, t, cnt = 0;
int main() {
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mx = min(mx, a[i]);
  }
  for (int i = 1; i <= n; i++) a[i] -= mx;
  t = mx * n;
  while (1) {
    if (a[x] == 0) break;
    a[x]--;
    x--, cnt++;
    if (x == 0) x = n;
  }
  a[x] += t + cnt;
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  return 0;
}
