#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000 * 1000 * 1000 + 7;
const long long int INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const long long int MOD2 = 998244353;
const long double PI = 3.141592653589793;
long long int gcd(long long int a, long long int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x %= p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int power1(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
int max(int a, int b) {
  if (a > b) return a;
  return b;
}
int min(int a, int b) {
  if (a > b) return b;
  return a;
}
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return a.second < b.second;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, x;
  cin >> n >> x;
  long long int arr[n + 1];
  int m = INT_MAX;
  int index = -1;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    if (m > arr[i]) {
      m = arr[i];
      index = i;
    } else if (m == arr[i]) {
      if (x >= index && x < i) continue;
      m = arr[i];
      index = i;
    }
  }
  long long int a = m * n;
  for (int i = 1; i <= n; i++) {
    arr[i] -= m;
  }
  for (int i = index + 1; i != x + 1; i++) {
    if (i == n + 1) i = 1;
    arr[i]--;
    a++;
  }
  arr[index] = a;
  for (int i = 1; i <= n; i++) {
    cout << arr[i] << " ";
  }
  return 0;
}
