#include <bits/stdc++.h>
int main() {
  long long n, x, a[100000], i, min, sum;
  scanf("%I64d%I64d", &n, &x);
  x--;
  for (i = 0; i < n; i++) scanf("%I64d", &a[i]);
  min = a[0];
  for (i = 0; i < n; i++)
    if (a[i] < min) min = a[i];
  for (i = 0; i < n; i++) a[i] -= min;
  sum = n * min;
  for (i = x;; i = (i + n - 1) % n) {
    if (a[i] == 0) {
      a[i] = sum;
      break;
    } else {
      a[i]--;
      sum++;
    }
  }
  for (i = 0; i < n; i++) printf("%I64d ", a[i]);
  return 0;
}
