#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAX_N = 1e5 + 10;
const long long mod = 1e9 + 9;
const double PI = acos(-1);
long long num[MAX_N << 1];
int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &num[i]);
    num[i + n] = num[i];
  }
  int be = x;
  for (int i = 1; i <= n; ++i) {
    if (num[i + x] <= num[be]) be = i + x;
  }
  int d = (n + x - be) % n;
  be = (be - 1) % n + 1;
  for (int i = be + 1; i < be + n; ++i) {
    num[i] -= num[be];
  }
  for (int i = be + 1; i <= be + d; ++i) {
    num[i]--;
  }
  num[be + n] = num[be] = num[be] * (long long)n + d;
  for (int i = 1; i <= n; ++i)
    printf("%I64d%c", min(num[i], num[i + n]), " \n"[i == n]);
  return 0;
}
