#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, x;
  cin >> n >> x;
  long long arr[100001];
  long long mini = 20000000000LL, minindx = 0LL;
  long long ac = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (long long i = x - 1;; --i) {
    if (i < 0) {
      i = n - 1;
    }
    if (arr[i] < mini) {
      mini = arr[i];
      minindx = i;
    }
    if (i == x || x == n && i == 0) {
      break;
    }
  }
  ac += mini * n;
  for (long long i = 0; i < n; ++i) {
    arr[i] -= mini;
  }
  for (long long i = x - 1;; --i) {
    if (i < 0) i = n - 1;
    if (i == minindx || arr[i] == 0) {
      break;
    }
    arr[i]--;
    ac++;
  }
  arr[minindx] = ac;
  for (long long i = 0; i < n; ++i) {
    cout << arr[i] << " ";
  }
  cout << endl;
  return 0;
}
