#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e18;
long long arr[100009];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, x;
  cin >> n >> x;
  long long mnind, mn = oo;
  for (long long i = (1); i < (long long)n + 1; i++) {
    cin >> arr[i];
    if (mn > arr[i]) {
      mn = arr[i];
    }
  }
  long long cnt = mn * n;
  for (long long i = (1); i < (long long)n + 1; i++) {
    arr[i] -= mn;
  }
  bool h = true;
  for (long long i = (x); i >= (long long)1; i--) {
    if (arr[i] == 0) {
      arr[i] = cnt;
      h = false;
      break;
    }
    cnt++;
    arr[i]--;
  }
  if (h) {
    for (long long i = (n); i >= (long long)1; i--) {
      if (arr[i] == 0) {
        arr[i] = cnt;
        h = false;
        break;
      }
      cnt++;
      arr[i]--;
    }
  }
  for (long long i = (1); i < (long long)n + 1; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
  return 0;
}
