#include <bits/stdc++.h>
using namespace std;
const int N = 1000228;
int a[N], c[N], v[N];
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  k--;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int delt = 0;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    if (i != k) {
      v.push_back(a[i]);
    } else {
      if (a[i] != 0) delt = 1;
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i <= n; i++) {
    c[i] = 0;
  }
  int cnt = 0;
  int j = -1;
  int ans = (int)1e9;
  if (!v.size()) {
    ans = 0;
  }
  for (int i = 1; i <= n; i++) {
    while (j < (int)v.size() - 1 && v[j + 1] <= i) {
      j++;
      c[v[j]]++;
      if (c[v[j]] == 1 && v[j] != 0) cnt++;
    }
    int really_bad = ((int)v.size() - j - 1) + c[0];
    int need = i - cnt;
    int free = j + 1 - cnt;
    if (need <= free + really_bad) {
      int temp = 0;
      temp += really_bad;
      if (temp < need) temp += min(free, need - temp);
      ans = min(ans, temp);
    }
  }
  ans = ans + delt;
  cout << ans;
  return 0;
}
