#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T a) {
  return a * a;
}
const int MAX_N = 1e5 + 10;
const long long INF = 1e18;
int N;
long long A[MAX_N];
inline int prev(int k) { return k ? k - 1 : N - 1; }
bool Used[MAX_N];
int main() {
  int X;
  scanf("%d%d", &N, &X);
  --X;
  long long Min = INF;
  for (int i = 0; i < (N); ++i) scanf("%I64d", &A[i]), Min = min(A[i], Min);
  int ans = X, res = 0;
  for (; A[ans] > Min; ans = prev(ans), ++res) A[ans] -= Min + 1, Used[ans] = 1;
  int i = ans;
  for (; !Used[i]; i = prev(i)) A[i] -= Min, Used[i] = 1;
  A[ans] = N * Min + res;
  for (int i = 0; i < (N); ++i) printf("%I64d ", A[i]);
  puts("");
  return 0;
}
