#include <bits/stdc++.h>
using namespace std;
void Yahia74() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 1e5 + 74, M = 1e5 + 74, OO = 0x3f3f3f3f;
long long a[N];
int main() {
  Yahia74();
  long long n, x;
  cin >> n >> x;
  --x;
  int mn = OO, imn = -1, cnt = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] < mn) mn = a[i], imn = i;
  }
  for (int i = 0; i < n; ++i) a[i] -= mn;
  int i;
  for (i = x; i >= 0; --i) {
    if (!a[i]) break;
    a[i]--;
    ++cnt;
    if (i == 0) i = n;
  }
  a[i] = n * mn + cnt;
  for (int i = 0; i < n; ++i) {
    cout << a[i] << ' ';
  }
  return 0;
}
