#include <bits/stdc++.h>
using namespace std;
int main() {
  long long add = 0;
  long long minn = 1000000009;
  int index = 0;
  vector<long long> vec;
  long long n, x, val;
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> val;
    if (minn > val) {
      minn = val;
      index = i;
    }
    vec.push_back(val);
  }
  for (int i = 0; i < n; i++) {
    vec[i] -= minn;
  }
  add = n * minn;
  x--;
  while (vec[x]) {
    vec[x]--;
    add++;
    x--;
    if (x < 0) x = n - 1;
  }
  vec[x] = add;
  for (int i = 0; i < n; i++) {
    cout << vec[i] << " ";
  }
  cout << endl;
  return 0;
}
