#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  ~debug() { cerr << '\n'; }
  template <class c>
  typename enable_if<sizeof dud<c>(0) != 1, debug&>::type operator<<(c i) {
    cerr << boolalpha << i;
    return *this;
  }
  template <class c>
  typename enable_if<sizeof dud<c>(0) == 1, debug&>::type operator<<(c i) {
    return *this << range(begin(i), end(i));
  }
  template <class c, class b>
  debug& operator<<(pair<b, c> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }
  template <class c>
  debug& operator<<(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};
long long int a[100005], seg[100005 << 2];
void build(int node, int start, int end) {
  if (start == end) {
    seg[node] = a[start];
    return;
  }
  int mid = (start + end) >> 1;
  build(node << 1, start, mid);
  build(node << 1 | 1, mid + 1, end);
  seg[node] = min(seg[node << 1], seg[node << 1 | 1]);
}
long long int query(int node, int start, int end, int l, int r) {
  if (l <= start && r >= end) return seg[node];
  if (r < start || l > end) return 1000000007;
  int mid = (start + end) >> 1;
  long long int ans1 = query(node << 1, start, mid, l, r);
  long long int ans2 = query(node << 1 | 1, mid + 1, end, l, r);
  return min(ans1, ans2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long int n, x;
    cin >> n >> x;
    for (long long int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    build(1, 1, n);
    long long int mini = query(1, 1, n, 1, n);
    for (long long int i = 1; i <= n; i++) {
      if (a[i] == mini) {
        if (i == x) {
          for (long long int j = 1; j <= n; j++) {
            if (j == i) {
              cout << n * mini << " ";
            } else {
              cout << a[j] - mini << " ";
            }
          }
          return 0;
        } else {
          long long int tmp_mini = 1e18;
          if (x > i) {
            tmp_mini = min(tmp_mini, query(1, 1, n, i + 1, x));
          } else {
            tmp_mini = min(tmp_mini, query(1, 1, n, i + 1, n));
            tmp_mini = min(tmp_mini, query(1, 1, n, 1, x));
          }
          if (tmp_mini >= mini + 1) {
            long long int cnt;
            if (x > i)
              cnt = x - i;
            else
              cnt = (n - i) + x;
            for (long long int j = 1; j <= n; j++) {
              if (j == i) {
                cout << n * mini + cnt << " ";
              } else {
                bool in_bw = false;
                if (x > i) {
                  if (i < j && j <= x) in_bw = true;
                } else {
                  if (i < j && j <= n) in_bw = true;
                  if (1 <= j && j <= x) in_bw = true;
                }
                if (!in_bw)
                  cout << a[j] - mini << " ";
                else
                  cout << a[j] - mini - 1 << " ";
              }
            }
            return 0;
          }
        }
      }
    }
  }
  return 0;
}
