#include <bits/stdc++.h>
using namespace std;
vector<int> vec;
int main() {
  int n, ss;
  scanf("%d %d", &n, &ss);
  int cou = 0;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    if (i == ss) {
      if (a != 0) ans++;
      continue;
    }
    if (a == 0) {
      cou++;
      continue;
    }
    vec.push_back(a);
  }
  sort(vec.begin(), vec.end());
  int in = 0;
  int s = 0;
  ans += cou;
  while (s < int(vec.size())) {
    int v = vec[s];
    if (v == in) {
    } else if (v == in + 1) {
      in++;
    } else {
      if (cou > 0) {
        cou--;
        in++;
        continue;
      } else {
        vec.pop_back();
        ans++;
      }
      in++;
      continue;
    }
    s++;
  }
  cout << ans << endl;
}
