#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, val = 1e9;
  cin >> n >> x;
  x--;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    val = min(val, arr[i]);
  }
  for (int i = 0; i < n; i++) {
    arr[i] -= val;
  }
  long long ans = val * n;
  while (arr[x]) {
    arr[x]--;
    ans++;
    x = ((x - 1) % n + n) % n;
  }
  arr[x] = ans;
  for (int i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  return 0;
}
