#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
void solve() {
  long long int n, s, a, zero = 0, root, ans = 0;
  cin >> n >> s;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    cin >> a;
    if (i == s - 1) {
      root = a;
    }
    if (a) {
      if (i != s - 1) {
        v.push_back(a);
      }
    } else {
      zero++;
    }
  }
  sort(v.begin(), v.end());
  if (root != 0) {
    zero++;
    ans++;
  }
  zero--;
  ans += zero;
  long long int prev = 0, last = (long long int)(v.size());
  for (long long int i = 0; i < last; i++) {
    if (v[i] - prev >= 2) {
      long long int val = v[i] - prev - 1;
      long long int p = min(val, zero);
      zero -= p;
      val -= p;
      long long int q = min(val, last - i - 1);
      last -= q;
      val -= q;
      ans += q;
      if (val != 0) {
        ans++;
        v[i] -= val;
      }
    }
    prev = v[i];
  }
  cout << ans << endl;
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
