#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)(1e9) * 3;
long long n, m = INF, k, a[100005], d, l = 0;
int main() {
  scanf("%I64d %I64d", &n, &k);
  for (long i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
    m = min(m, a[i]);
  }
  d = k - 1;
  while (a[d] - m > 0) {
    a[d]--;
    l++;
    d--;
    if (d < 0) d = n - 1;
  }
  a[d] += l + n * a[d];
  for (long i = 0; i < n; i++) printf("%I64d ", a[i] - m);
  return 0;
}
