#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3fLL;
const double err = 1e-9;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;
ll x, n;
ll b[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> x;
  ll m = 100000000000;
  for (int(i) = (0); (i) < (n); (i)++) {
    cin >> b[i];
    if (b[i] < m) m = b[i];
  }
  for (int(i) = (0); (i) < (n); (i)++) b[i] -= max(0LL, m - 1);
  ll s = n * max(m - 1, 0LL);
  x--;
  if (x < 0) x = n - 1;
  while (b[x] > 0) {
    b[x]--;
    x--;
    s++;
    if (x == -1) x = n - 1;
  }
  b[x] = s;
  for (int(i) = (0); (i) < (n); (i)++) cout << b[i] << ' ';
  cout << endl;
  return 0;
}
