#include <bits/stdc++.h>
int n, x, p, f, t;
int a[100010], l;
long long w;
int main() {
  scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), f = f | !a[i];
  p = 1;
  for (int i = 1; i <= n; ++i)
    if (a[p] > a[i]) p = i;
  if (a[p] == a[x])
    p = x;
  else {
    f = 0;
    for (int i = x - 1; i >= 1; --i)
      if (a[i] == a[p]) {
        p = i, f = 1;
        break;
      }
    if (!f) {
      for (int i = n; i >= x + 1; --i)
        if (a[i] == a[p]) {
          p = i;
          break;
        }
    }
  }
  l = a[p];
  w = n * 1ll * l;
  for (int i = 1; i <= n; ++i) a[i] -= l;
  if (p > x) {
    w += n - (p - x);
    for (int i = 1; i <= x; ++i) --a[i];
    for (int i = p + 1; i <= n; ++i) --a[i];
  } else {
    w += x - p;
    for (int i = p + 1; i <= x; ++i) --a[i];
  }
  for (int i = 1; i <= n; ++i)
    if (i == p)
      printf("%lld ", w);
    else
      printf("%d ", a[i]);
}
