#include <bits/stdc++.h>
using namespace std;
const int N = 13;
long long a[200010];
int main() {
  long long n, m, sum = 0;
  cin >> n >> m;
  long long minn = 0x3f3f3f3f3f3f;
  for (int i = 1; i <= n; i++) scanf("%lld", a + i), minn = min(minn, a[i]);
  for (int i = 1; i <= n; i++) a[i] -= minn;
  while (a[m] != 0) {
    a[m]--;
    m--;
    sum++;
    if (m == 0) m = n;
  }
  a[m] = sum + minn * n;
  for (int i = 1; i <= n; i++) printf("%lld ", a[i]);
  printf("\n");
  return 0;
}
