#include <bits/stdc++.h>
using namespace std;
long long a[100000];
int main() {
  long long n, x;
  cin >> n >> x;
  x--;
  long long low = 10000000000;
  long long lowi = -1;
  long long bonus = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < low || (a[i] == low && (i <= x || (lowi > x)))) {
      low = a[i];
      lowi = i;
    }
  }
  for (long long i = 0; i < n; i++) {
    if (i != lowi) {
      a[i] -= low;
      bonus += low;
    }
  }
  if (lowi <= x) {
    for (long long i = lowi + 1; i <= x; i++) {
      a[i]--;
      bonus++;
    }
  } else {
    for (long long i = lowi + 1; i < n; i++) {
      a[i]--;
      bonus++;
    }
    for (long long i = 0; i <= x; i++) {
      a[i]--;
      bonus++;
    }
  }
  a[lowi] += bonus;
  for (long long i = 0; i < n; i++) cout << a[i] << ' ';
}
