#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  long long a[100007], mn = 999999999;
  x--;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mn = min(a[i], mn);
  }
  for (int i = 0; i < n; i++) {
    a[i] -= mn;
  }
  long long ans = mn * n;
  while (a[x]) {
    --a[x];
    ++ans;
    --x;
    if (x < 0) x = n - 1;
  }
  a[x] = ans;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
