#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, rt, x, k, ans;
int a[N];
int main() {
  scanf("%d%d", &n, &rt);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (i == rt && x != 0)
      ans++;
    else if (i != rt && x == 0) {
      ans++;
      k++;
    } else
      a[x]++;
  }
  int sum = 1;
  for (int i = 1; i < n; i++) {
    if (sum >= n) break;
    if (!a[i]) {
      if (k)
        k--;
      else
        ans++;
      sum++;
    } else
      sum += a[i];
  }
  printf("%d\n", ans);
  return 0;
}
