#include <bits/stdc++.h>
long long aa[100500];
long long mina(long long a, long long b) { return a > b ? b : a; }
int main() {
  long long n, m, s = 0, i, j, minn = (long long)1e60;
  scanf("%lld %lld", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &aa[i]);
    minn = mina(minn, aa[i]);
  }
  for (i = 1; i <= n; i++) aa[i] -= minn;
  s = minn * n;
  while (aa[m]) {
    aa[m]--;
    m--;
    s++;
    if (m == 0) m = n;
  }
  aa[m] = s;
  for (i = 1; i < n; i++) printf("%lld ", aa[i]);
  printf("%lld\n", aa[i]);
  return 0;
}
