#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  --x;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  int k = x;
  for (int i = 0; i < n; ++i) {
    if (a[(x - i + n) % n] < a[k]) k = (x - i + n) % n;
  }
  long long b = a[k] + 1;
  for (int i = 0; i < n; ++i) {
    a[(k + i) % n] -= b;
    a[k] += b;
    if ((k + i) % n == x) --b;
  }
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
  cout << endl;
  return 0;
}
