#include <bits/stdc++.h>
using namespace std;
const int NR = 2e5 + 10;
int a[NR], pos[NR];
int main() {
  int n, s, ans = 0, sum = 1;
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (i == s && a[i] != 0)
      ans++;
    else
      pos[a[i]]++;
  }
  for (int i = 1; sum < n; i++) {
    sum += max(1, pos[i]);
    ans += (!pos[i]);
  }
  printf("%d", ans);
  return 0;
}
