#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = (int)1e9;
const int MAX_N = 200 * 1000 + 1000;
const int REM = inf + 9;
int n, x;
long long arr[MAX_N];
int main() {
  cin >> n >> x;
  x--;
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long mini = *min_element(arr, arr + n);
  int here;
  for (int i = x;; i--) {
    here = (i + 2 * n) % n;
    if (arr[here] == mini) break;
  }
  long long balls = n * arr[here];
  if (here <= x) {
    balls += x - here;
  } else {
    balls += n - (here - x);
  }
  int i = x + 1;
  while (1) {
    arr[i % n] -= mini;
    if (i % n == here)
      break;
    else
      i++;
  }
  if (here != x) {
    i = x;
    while (1) {
      int idx = (i + 2 * n) % n;
      if (idx == here) break;
      arr[idx] -= (mini + 1);
      i--;
    }
  }
  arr[here] = balls;
  for (i = 0; i < n; i++) {
    if (i) cout << " ";
    cout << arr[i];
  }
  cout << endl;
  return 0;
}
