#include <bits/stdc++.h>
using namespace std;
int n, s, a[200020], p[200020];
void solve() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  int ans = 0;
  if (a[s] != 0) ans++;
  for (int i = 1; i <= n; i++)
    if (i != s) {
      p[a[i]]++;
    }
  for (int i = 1, c = n - 1; i < n; i++) {
    if (p[i] > 0) {
      c -= p[i];
      if (c <= 0) break;
    } else {
      c--;
      ans++;
      if (c == 0) break;
    }
  }
  printf("%d", ans);
}
int main() {
  int Tc = 1;
  for (int tc = 1; tc <= Tc; tc++) {
    solve();
  }
  return 0;
}
