#include <bits/stdc++.h>
const long long N = 300005;
using namespace std;
int n, x;
long long mi = 1000000000;
vector<long long> g(100100), v(100100);
int main() {
  scanf("%d %d", &n, &x);
  x--;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &v[i]);
    mi = min(mi, v[i]);
  }
  g = v;
  int aux = -1;
  for (int i = x; i >= 0; --i) {
    if (v[i] == mi) {
      aux = i;
      break;
    }
  }
  if (aux == -1)
    for (int i = n - 1; i > x; --i) {
      if (v[i] == mi) {
        aux = i;
        break;
      }
    }
  int j = aux - 1;
  long long sum = 0;
  while (j != x) {
    v[j] -= v[aux];
    sum += v[aux];
    j--;
    if (j < 0) j = n - 1;
  }
  while (j != aux) {
    v[j] -= v[aux] + 1;
    sum += v[aux] + 1;
    j--;
    if (j < 0) j = n - 1;
  }
  sum = 0;
  for (int i = 0; i < n; i++)
    if (i != aux) sum += g[i] - v[i];
  v[aux] += sum;
  for (int i = 0; i < n; ++i) {
    printf("%lld ", v[i]);
  }
  printf("\n");
  return 0;
}
