#include <bits/stdc++.h>
using namespace std;
int a[200010];
int cnt[200010];
int cum[200010];
int vis[200010];
int cumvis[200010];
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  int inc = 0;
  int glupe_nule = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (i != s && a[i] == 0) {
      inc++;
      glupe_nule++;
    }
  }
  if (n == 1) {
    if (a[1] == 0)
      return 0 * puts("0");
    else
      return 0 * puts("1");
  }
  if (a[s] != 0) ++inc;
  int ins = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] != 0 && i != s) {
      ins++;
      cnt[a[i]]++;
      vis[a[i]] = 1;
    }
  for (int i = 1; i <= n; i++) cum[i] = cum[i - 1] + cnt[i];
  for (int i = 1; i <= n; i++) cumvis[i] = cumvis[i - 1] + vis[i];
  int ans = n;
  if (ins == 0)
    ans = 0;
  else
    for (int maxd = 1; maxd <= n - 1; maxd++) {
      int fali = max(0, maxd - cumvis[maxd]);
      fali = max(0, fali - glupe_nule);
      int visak = max(0, ins - cum[maxd]);
      ans = min(ans, max(fali, visak));
    }
  printf("%d\n", ans + inc);
  return 0;
}
