#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, x;
  cin >> n >> x;
  long long int arr[n + 1];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  long long int min1 = 1e18;
  long long int pos = 0;
  for (long long int i = 0; i < n; i++) {
    if (min1 > arr[i]) min1 = arr[i], pos = i;
  }
  for (long long int i = 0; i < n; i++) {
    arr[i] -= min1;
  }
  long long int ans = n * min1;
  while (true) {
    if (arr[(x - 1 + n) % n] == 0) {
      arr[(x - 1 + n) % n] = ans;
      break;
    }
    x = (x - 1 + n) % n;
    arr[x]--;
    ans++;
  }
  for (long long int i = 0; i < n; i++) cout << arr[i] << " ";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
