#include <bits/stdc++.h>
using namespace ::std;
int main() {
  int n, s;
  scanf("%d", &n);
  scanf("%d", &s);
  s--;
  int ans = 0;
  vector<int> A(n, 0);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    if (i == s) {
      if (x != 0) ans++;
      A[0]++;
    } else {
      A[x]++;
    }
  }
  vector<int> B;
  B.reserve(n);
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < A[i]; j++) B.push_back(i);
  }
  for (int i = 1; i < n; i++) {
    if (A[i] > 0) continue;
    if (A[0] > 1) {
      A[i]++;
      A[0]--;
      ans++;
      continue;
    }
    if (B.empty()) break;
    if (B.back() < i) break;
    int x = B.back();
    A[i]++;
    A[x]--;
    ans++;
    B.pop_back();
  }
  printf("%d\n", ans);
  return 0;
}
