#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, i, a_min, box_or, val;
  long long a[100005];
  val = 0;
  a_min = 1000000005;
  cin >> n;
  cin >> x;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    if (a[i] < a_min) {
      a_min = a[i];
    }
  }
  box_or = x - 1;
  while (a[box_or] > a_min) {
    val = val + 1;
    a[box_or] = a[box_or] - 1;
    box_or--;
    if (box_or == -1) box_or = n - 1;
  }
  for (i = 0; i < n; i++) {
    a[i] = a[i] - a_min;
  }
  a[box_or] = n * a_min + val;
  for (i = 0; i < n; i++) {
    cout << a[i] << endl;
  }
}
