#include <bits/stdc++.h>
using namespace std;
const unsigned long long INF = -1;
const int M = 1e5 + 5;
long long now[M];
int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  long long minn = INF >> 1, loc, dis = INF >> 1;
  x--;
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &now[i]);
    long long tmp = x - i;
    if (tmp < 0) {
      tmp += n;
    }
    if (minn > now[i]) {
      minn = now[i];
      loc = i;
      dis = tmp;
    } else if (minn == now[i] && dis > tmp) {
      loc = i;
      dis = tmp;
    }
  }
  long long num = minn * n + dis;
  int c = (loc + 1) % n;
  for (int i = 0; i < n; i++) {
    now[i] -= minn;
  }
  for (long long i = 0; i < dis; i++) {
    now[c]--;
    c = (c + 1) % n;
  }
  now[loc] = num;
  for (int i = 0; i < n - 1; i++) {
    printf("%I64d ", now[i]);
  }
  printf("%I64d\n", now[n - 1]);
  return 0;
}
