#include <bits/stdc++.h>
using namespace std;
long long int a[100000 + 10];
int main() {
  long long int n, i, j, k, minimum = 10000000120, x, sum = 0;
  cin >> n >> x;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    minimum = min(a[i], minimum);
  }
  for (i = 0; i < n; i++) {
    a[i] -= minimum;
  }
  sum = n * minimum;
  for (i = x - 1; i >= 0; i--) {
    if (a[i] == 0) {
      a[i] = sum;
      break;
    }
    a[i]--;
    sum++;
  }
  if (i < 0) {
    for (i = n - 1; i > x - 1; i--) {
      if (a[i] == 0) {
        a[i] = sum;
        break;
      }
      a[i]--;
      sum++;
    }
  }
  for (i = 0; i < n; i++) {
    if (i != n - 1)
      cout << a[i] << " ";
    else
      cout << a[i] << endl;
  }
  return 0;
}
