#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, x, a[N];
int main() {
  scanf("%d%d", &n, &x);
  x--;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  int y = 0;
  for (int i = 1; i < n; i++)
    if (a[i] < a[y] || (a[i] == a[y] && ((x - y + n) % n) > ((x - i + n) % n)))
      y = i;
  long long by = (long long)a[y] * n + (x - y + n) % n;
  for (int i = 0; i < n; i++) {
    if (i == y)
      printf("%I64d ", by);
    else {
      int c = (i - y + n) % n;
      if (by < c)
        printf("%I64d ", (long long)a[i]);
      else
        printf("%I64d ", a[i] - (by - c) / n - 1);
    }
  }
  return 0;
}
