#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
int ans = 0;
int extra = 0;
int N, S, A[MAXN], cnt[MAXN];
int main() {
  scanf("%d", &N), scanf("%d", &S);
  S--;
  for (int i = 0; i < (int)N; i++) scanf("%d", &A[i]);
  if (A[S] != 0) ans = 1;
  for (int i = 0; i < (int)N; i++)
    if (i != S && A[i] == 0) ans++, extra++;
  for (int i = 0; i < (int)N; i++)
    if (i != S) cnt[A[i]]++;
  int lo = 1, hi = N - 1;
  while (lo < hi) {
    while (lo < N && cnt[lo] != 0) lo++;
    while (hi >= 0 && cnt[hi] == 0) hi--;
    if (lo < hi) {
      cnt[lo]++;
      if (extra > 0)
        extra--;
      else {
        cnt[hi]--;
        ans++;
      }
    }
  }
  printf("%d\n", ans);
}
