#include <bits/stdc++.h>
using namespace std;
int N, x;
long long a[100005], t(0x7f7f7f7f7f7f7f7f);
void pre(int &x) {
  x--;
  if (x == 0) x = N;
}
int main() {
  scanf("%d%d", &N, &x);
  for (int i = 1; i <= N; ++i) scanf("%I64d", &a[i]), t = min(t, a[i]);
  for (int i = 1; i <= N; ++i) a[i] -= t;
  t *= N;
  while (a[x]) a[x]--, t++, pre(x);
  a[x] = t;
  for (int i = 1; i <= N; ++i) printf("%I64d ", a[i]);
  return 0;
}
