#include <bits/stdc++.h>
using namespace std;
int n, x;
long long mn = LLONG_MAX, a[100001];
int main() {
  scanf("%d%d", &n, &x);
  x--;
  for (int i = 0; i < n; i++) scanf("%lld", a + i), mn = min(a[i], mn);
  for (int i = 0; i < n; i++) a[i] -= mn;
  for (int i = x; 1; i = (i + n - 1) % n)
    if (!a[i]) {
      a[i] = 1ll * mn * n;
      for (int j = x; j != i; j = (j + n - 1) % n) a[j]--, a[i]++;
      break;
    }
  for (int i = 0; i < n; i++) printf("%lld ", a[i]);
}
