#include <bits/stdc++.h>
using namespace std;
int n, x;
const int N = 100010;
long long a[N], mmin = 0x7fffffffffffLL;
int main() {
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mmin = min(mmin, a[i]);
  }
  long long u = 0;
  for (int i = 1; i <= n; i++) a[i] -= mmin;
  while (a[x] != 0) {
    u++;
    a[x]--;
    x--;
    if (x < 1) x = n;
  }
  a[x] += u + mmin * n;
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  return 0;
}
