#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, x;
  cin >> n >> x;
  x--;
  vector<long long> a(n);
  long long minn = INT_MAX, minidx = -1;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (minn > a[i]) {
      minidx = i;
      minn = a[i];
    }
  }
  vector<long long> small;
  for (long long i = 0; i < n; i++) {
    if (a[i] == minn) small.push_back(i);
  }
  long long st, tm;
  if (small.size() == 1) {
    st = minidx;
    tm = a[minidx];
  } else {
    long long idx;
    if (x > small[small.size() - 1] || x < small[0])
      idx = small.size() - 1;
    else {
      idx = lower_bound(small.begin(), small.end(), x) - small.begin();
      if (small[idx] != x) idx--;
    }
    st = small[idx];
    tm = a[st];
  }
  for (long long i = 0; i < n; i++) {
    a[i] = a[i] - tm;
  }
  if (x != st) {
    long long i = st + 1, cnt = 0;
    if (i == n) i = 0;
    for (; i != st; (i == n - 1) ? i = 0 : i++) {
      a[i]--;
      cnt++;
      if (i == x) break;
    }
    a[st] += cnt;
  }
  a[st] += (tm * n);
  for (long long i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
