#include <bits/stdc++.h>
using namespace std;
int n, x;
long long a[100001], mn = INT_MAX;
int main() {
  scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", a + i);
    mn = min(a[i], mn);
  }
  for (int i = 1; i <= n; i++) a[i] -= mn;
  for (int i = x; 1; i = (i == 1 ? n : i - 1))
    if (!a[i]) {
      a[i] = mn * n;
      for (int j = x; j != i; j = (j == 1 ? n : j - 1)) a[j]--, a[i]++;
      break;
    }
  for (int i = 1; i <= n; i++) printf("%lld ", a[i]);
}
