#include <bits/stdc++.h>
long long a[100005];
int main() {
  int n, x, i;
  long long t, mn;
  for (scanf("%d%d", &n, &x), mn = 1 << 30, i = 0; i < n; i++)
    scanf("%I64d", &a[i]), mn = a[i] < mn ? a[i] : mn;
  for (t = mn * n, x--; a[x] > mn;) {
    a[x]--, t++, x--;
    if (x < 0) x += n;
  }
  a[x] = t + mn;
  for (i = 0; i < n; i++) printf("%I64d%c", a[i] - mn, "\n "[i < n - 1]);
  return 0;
}
