#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
long long n, x;
long long a[100005];
long long minn = INF;
int main() {
  int f;
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    if (minn > a[i]) {
      minn = a[i];
    }
  }
  long long T = minn;
  for (int i = 1; i <= n; i++) a[i] = a[i] - T;
  T = T * n;
  while (a[x] != 0) {
    T++;
    a[x]--;
    x--;
    if (x == 0) x = n;
  }
  a[x] = T;
  for (int i = 1; i < n; i++) printf("%I64d ", a[i]);
  printf("%I64d\n", a[n]);
}
