#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e9;
const long long mod = 1e9 + 7;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int n, x, mni;
long long boxes[100 * 1000 + 5];
int zeroi;
void printBoxes() {
  for (int i = 0; i < (int)(n); ++i) cout << boxes[i] << " ";
  cout << endl;
}
int main() {
  fast();
  while (cin >> n >> x) {
    x--;
    long long mn = 1e9 + 5, mni = -1;
    long long cnt = 0;
    for (int i = 0; i < (int)(n); ++i) {
      cin >> boxes[i];
      if (mn > boxes[i]) {
        mn = boxes[i];
        mni = i;
      }
    }
    for (int i = 0; i < (int)(n); ++i) {
      cnt += mn;
      boxes[i] -= mn;
    }
    int idx = x;
    while (boxes[idx] > 0) {
      boxes[idx]--;
      cnt++;
      idx = (idx - 1 + n) % n;
    }
    boxes[idx] += cnt;
    printBoxes();
  }
  return 0;
}
