#include <bits/stdc++.h>
using namespace std;
long long n, x;
long long a[200000];
int main() {
  cin >> n >> x;
  x--;
  long long Min = 2e9;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    Min = min(a[i], Min);
  }
  int d = 2e9, ind;
  for (int i = 0; i < n; i++) {
    if (a[i] == Min) {
      int y = (x - i + n) % n;
      if (y < d) {
        d = y;
        ind = i;
      }
    }
  }
  long long p = a[ind];
  for (int i = 0; i < n; i++) {
    if (i == ind) {
      a[i] = p * n + ((x - ind + n) % n);
      continue;
    }
    a[i] -= p;
    if (ind <= x) {
      if (i <= x && ind <= i) a[i]--;
    } else {
      if (i >= ind || i <= x) a[i]--;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
