#include <bits/stdc++.h>
using namespace std;
long long n, x, a[100000];
int main() {
  cin >> n >> x;
  x--;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long p, m = 1000000001;
  for (int i = 0; i < n; i++)
    if (m > a[i]) m = a[i], p = i;
  if (m - 1 > 0)
    for (int i = 0; i < n; i++) a[i] -= (m - 1);
  long long pl = 0;
  while (true) {
    if (a[x] == 0) {
      a[x] += pl;
      break;
    }
    a[x]--;
    pl++;
    x--;
    if (x < 0) x = n - 1;
  }
  if (m - 1 > 0) a[x] += n * (m - 1);
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
