#include <bits/stdc++.h>
using namespace std;
long long a[111111], n, m, b, s = 0;
long long prev(long long x) { return x == 0 ? n - 1 : x - 1; }
int main() {
  scanf("%d%d", &n, &m);
  --m;
  for (long long i = 0; i < n; ++i) scanf("%d", &a[i]);
  b = m;
  long long cur = b;
  for (long long i = 0; i < n; ++i) {
    cur = prev(cur);
    if (a[cur] < a[b]) b = cur;
  }
  while (m != b) {
    ++s;
    a[m]--;
    m = prev(m);
  }
  s += n * a[b];
  for (int i = 0; i < n; ++i) {
    if (i != b) a[i] -= a[b];
  }
  a[b] = s;
  for (int i = 0; i < n; ++i) {
    printf("%I64d ", a[i]);
  }
  return 0;
}
