#include <bits/stdc++.h>
using namespace std;
long long a[100010], i, n, m, now, t, tt;
bool bo;
int main() {
  scanf("%lld%lld", &n, &m);
  a[0] = 1e9;
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  now = m;
  t = m - 1;
  if (t == 0) t = n;
  while (t != m) {
    if (a[now] > a[t]) now = t;
    t--;
    if (t == 0) t = n;
  }
  tt = a[now];
  for (i = 1; i <= n; i++) {
    a[i] -= tt;
    a[now] += tt;
  }
  if (now != m) {
    t = m - 1;
    if (t == 0) t = n;
    while (t != now) {
      a[t]--, a[now]++;
      t--;
      if (t == 0) t = n;
    }
    a[m]--, a[now]++;
  }
  for (i = 1; i <= n; i++) printf("%lld ", a[i]);
}
