#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  int v[100000];
  int minimum = 1000000000;
  int iMin = 0;
  scanf("%d%d", &n, &x);
  x--;
  for (int i = 0; i < n; i++) {
    scanf("%d", v + i);
    if (v[i] < minimum) {
      minimum = v[i];
    }
  }
  for (int i = 0; i < n; i++) {
    v[i] -= minimum;
  }
  long long OutBalls = (long long)minimum * n;
  int t;
  for (int i = 0; i < n; i++) {
    t = (x - i + n) % n;
    if (v[t] != 0) {
      v[t]--;
      OutBalls++;
    } else {
      iMin = t;
      break;
    }
  }
  v[iMin] = OutBalls;
  for (int i = 0; i < n; i++) {
    if (iMin == i) {
      printf("%I64d ", OutBalls);
    } else
      printf("%d ", v[i]);
  }
  return 0;
}
