#include <bits/stdc++.h>
using namespace std;
int A[100007];
int main() {
  int N, X;
  scanf("%d %d ", &N, &X);
  ;
  X--;
  for (int i = (0); i < (N); i++) scanf("%d ", &A[i]);
  ;
  int mn = 1000000007;
  for (int i = (0); i < (N); i++) mn = min(mn, A[i]);
  long long init = (long long)mn * (long long)N;
  for (int i = (0); i < (N); i++) A[i] -= mn;
  int i = X;
  while (A[X] > 0) {
    init++;
    A[X]--;
    X--;
    if (X < 0) X += N;
  }
  for (int i = (0); i < (N); i++) {
    if (i == X)
      cout << init << " ";
    else
      cout << A[i] << " ";
  }
  cout << endl;
  return 0;
}
