#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T MAX(T a, T b) {
  if (a > b) return a;
  return b;
}
template <class T>
inline T MIN(T a, T b) {
  if (a < b) return a;
  return b;
}
template <class T>
inline T ABS(T x) {
  if (x < 0) return -x;
  return x;
}
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const static int inf = 1000000000;
int n, x;
long long arr[100005];
int main() {
  scanf("%d%d", &n, &x);
  x--;
  for (int(i) = (0); (i) < (n); ++(i)) scanf("%I64d", &arr[i]);
  int now = x - 1, idx = x;
  if (now < 0) now += n;
  long long mins = arr[x];
  while (now != x) {
    if (mins > arr[now]) {
      mins = arr[now];
      idx = now;
    }
    now--;
    now = (now + n) % n;
  }
  now = idx + 1;
  if (now >= n) now -= n;
  long long tot = mins;
  while (now != idx) {
    if (idx > x) {
      if (now > idx || now <= x) {
        arr[now] -= mins + 1;
        tot += mins + 1;
      } else {
        arr[now] -= mins;
        tot += mins;
      }
    } else if (idx < x) {
      if (now > idx && now <= x) {
        arr[now] -= mins + 1;
        tot += mins + 1;
      } else {
        arr[now] -= mins;
        tot += mins;
      }
    } else {
      arr[now] -= mins;
      tot += mins;
    }
    now++;
    if (now >= n) now -= n;
  }
  arr[idx] = tot;
  for (int(i) = (0); (i) < (n); ++(i)) {
    if (i) printf(" ");
    printf("%I64d", arr[i]);
  }
  printf("\n");
  return 0;
}
