#include <bits/stdc++.h>
int main() {
  int n, x;
  int a[100000];
  int m, h, k;
  long long v;
  std::ios::sync_with_stdio(false);
  std::scanf("%d%d", &n, &x);
  for (int i(0); i < n; ++i) std::scanf("%d", a + i);
  m = *std::min_element(a, a + n);
  h = (x - 1) % n;
  while (a[h] != m) h = (n + h - 1) % n;
  x %= n;
  k = (h + 1) % n;
  v = (long long)m * n;
  for (int i(0); i < n; ++i) a[i] -= m;
  while (k != x) {
    v++, a[k]--;
    k = (k + 1) % n;
  }
  for (int i(0); i < n; ++i) std::cout << (i != h ? a[i] : v) << ' ';
  std::cout << std::endl;
  return 0;
}
