#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
long long a[N];
int main() {
  srand(time(NULL));
  int n, pos;
  cin >> n >> pos;
  long long mn = 2147483647;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mn = min(a[i], mn);
  }
  bool w = false;
  if (a[pos] == mn) {
    a[pos] = 0;
    a[pos] += n * mn;
    w = true;
  }
  if (!w) {
    long long pos1 = pos;
    a[pos]--;
    pos--;
    int kol = 1;
    while (pos1 != pos && !w) {
      if (a[pos] == mn) {
        a[pos] = 0;
        a[pos] += n * mn + kol;
        w = true;
      }
      if (!w) {
        kol++;
        a[pos]--;
        pos--;
        if (pos == 0) pos = n;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i == pos) {
      cout << a[i] << " ";
      continue;
    }
    cout << a[i] - mn << " ";
  }
  return 0;
}
