#include <bits/stdc++.h>
using namespace std;
void play() {
  long long n, can, x;
  cin >> n >> x;
  vector<long long> arr;
  long long minel = 2140000000;
  for (auto i = 0 - (0 > n); (i < n) ^ (0 > n); i += 1 - 2 * (0 > n)) {
    cin >> can;
    arr.push_back(can);
    minel = min(can, minel);
  }
  for (auto &el : arr) {
    el -= minel;
  }
  long long thisbox = minel * n;
  long long pos = --x;
  while (arr[pos] != 0) {
    --arr[pos];
    ++thisbox;
    --pos;
    if (pos < 0) {
      pos = n - 1;
    }
  }
  arr[pos] = thisbox;
  for (auto el : arr) {
    cout << el << " ";
  }
  cout << endl;
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    play();
  }
  return 0;
}
