#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, x;
  cin >> n >> x;
  x--;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long mn = a[x];
  for (long long i = 0; i < n; i++) {
    if (a[i] < mn) {
      mn = a[i];
    }
  }
  long long ans = mn * n;
  while (a[x] != mn) {
    a[x]--;
    ans++;
    x--;
    if (x < 0) x = n - 1;
  }
  for (long long i = 0; i < n; i++) cout << (i == x ? ans : a[i] - mn) << " ";
  cout << "\n";
  return 0;
}
