#include <bits/stdc++.h>
using namespace std;
long long int num[100005], n, k;
int main() {
  cin >> n >> k;
  int Min = -1, in;
  for (int i = 0; i < n; i++) {
    cin >> num[i];
    if (Min == -1) Min = num[i];
    if (Min >= num[i]) {
      Min = num[i];
      in = i;
    }
  }
  k--;
  if (in < k)
    ;
  else if (num[k] == Min)
    in = k;
  else
    for (int i = k; i >= 0; i--)
      if (num[i] == Min) {
        in = i;
        break;
      }
  int l = k, ex = 0;
  if (in > k) l = n - 1;
  for (int i = in + 1; i <= l; i++) {
    num[i]--;
    ex++;
  }
  if (in > k)
    for (int i = 0; i < k + 1; i++) {
      num[i]--;
      ex++;
    }
  for (int i = 0; i < n; i++)
    if (i != in) num[i] = num[i] - num[in];
  num[in] = ex + num[in] * n;
  for (int i = 0; i < n; i++) cout << num[i] << " ";
  cout << endl;
  return 0;
}
