#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const long long inf = 1e9 + 10;
int n, x;
long long a[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> x;
  x--;
  long long minE = inf;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    minE = min(minE, a[i]);
  }
  long long og = (minE * n);
  for (int i = 0; i < n; i++) {
    a[i] -= minE;
  }
  while (true) {
    if (a[(x + n) % n] == 0) {
      a[(x + n) % n] = og;
      break;
    }
    a[x]--;
    x = (x - 1 + n) % n;
    og++;
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
