#include <bits/stdc++.h>
using namespace std;
int n, chief;
int a[200005], c[200005];
int res;
int main() {
  scanf("%d%d", &n, &chief);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (i == chief && a[i] != 0) {
      res++;
      a[i] = 0;
    } else if (i != chief && a[i] == 0)
      a[i] = n;
    c[a[i]]++;
  }
  int cnt = n;
  for (int i = 1; i <= n - 1; i++) {
    if (c[i] > 0) continue;
    while (c[cnt] == 0) cnt--;
    if (i >= cnt) break;
    res++;
    c[cnt]--;
  }
  printf("%d\n", res);
  return 0;
}
