#include <bits/stdc++.h>
using namespace std;
long long a[100005];
bool bein(int i, int iMin, int x) {
  if (iMin <= x)
    return (i >= iMin && i <= x);
  else
    return (i <= x || i >= iMin);
}
int main() {
  int n, x;
  cin >> n >> x;
  x--;
  int iMin = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (iMin == -1 || a[i] < a[iMin]) iMin = i;
  }
  int Min = a[iMin];
  bool f = false;
  for (int i = 0; i < n; i++)
    if (a[i] == Min) {
      if (i <= x) {
        iMin = i;
        f = true;
      } else if (!f)
        iMin = i;
    }
  long long cost = 0;
  for (int i = 0; i < n; i++) {
    if (i != iMin) {
      a[i] -= a[iMin];
      cost += a[iMin];
      if (bein(i, iMin, x)) {
        a[i]--;
        cost++;
      }
    }
  }
  a[iMin] += cost;
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << ' ';
    cout << a[i];
  }
  cout << endl;
  return 0;
}
