#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
long long a[N];
int flag[N];
int n, m;
bool check(long long a[]) {
  for (int i = 2; i <= n; i++)
    if (a[i] != a[i - 1]) return 0;
  return 1;
}
vector<int> v;
int main() {
  cin >> n >> m;
  int sum = 0;
  long long minv = 1e9 + 10;
  int pos = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] < minv) {
      minv = a[i];
      pos = i;
    }
    minv = min(a[i], minv);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == minv) cnt++;
  if (cnt != 1) {
    bool ff = false;
    for (int i = m; i >= 1; i--)
      if (a[i] == minv) {
        ff = true;
        pos = i;
        break;
      }
    if (!ff) {
      for (int i = n; i >= 1; i--)
        if (a[i] == minv) {
          pos = i;
          break;
        }
    }
  }
  if (check(a)) pos = m;
  int tt = a[pos];
  int tt22 = (m - pos + n) % n;
  int tt2 = tt22;
  for (int i = pos + 1; i <= n; i++) {
    if (tt2 == 0) break;
    tt2--;
    flag[i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    if (tt2 == 0) break;
    tt2--;
    flag[i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    if (i != pos) {
      cout << a[i] - tt - flag[i] << ' ';
    } else {
      cout << a[pos] * n + tt22 << ' ';
    }
  }
  cout << endl;
  return 0;
}
