#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
double EPS = 1e-9;
int INF = 1000000000;
int MAXINT = 2147483647;
long long INFLL = 1000000000000000000LL;
long long MAXLL = 9223372036854775807LL;
pair<int, int> M[8] = {make_pair(0, 1),  make_pair(1, 0),  make_pair(-1, 0),
                       make_pair(0, -1), make_pair(-1, 1), make_pair(-1, -1),
                       make_pair(1, -1), make_pair(1, 1)};
long long ar[100100];
long long res = 0;
int main() {
  int n, x;
  scanf("%d %d", &n, &x);
  for (int(a) = (1); (a) <= (n); (a)++) {
    scanf("%I64d", &ar[a]);
  }
  long long mins = INF;
  for (int(a) = (1); (a) <= (n); (a)++) {
    mins = min(mins, ar[a]);
  }
  res = mins * n;
  for (int(a) = (1); (a) <= (n); (a)++) {
    ar[a] -= mins;
  }
  int cur = x;
  while (ar[cur] != 0) {
    ar[cur]--;
    res++;
    cur--;
    if (cur == 0) cur = n;
  }
  ar[cur] = res;
  for (int(a) = (1); (a) <= (n); (a)++) {
    printf("%I64d ", ar[a]);
  }
}
