#include <bits/stdc++.h>
using namespace std;
const int N = 200008;
int n, m, a[N], b[N];
int main(void) {
  int i, k, ans, s;
  ans = 0;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", a + i);
  if (a[m]) {
    a[m] = 0;
    ans++;
  }
  for (i = 1; i <= n; i++)
    if (i != m && a[i] == 0) {
      a[i] = n + 1;
    }
  for (i = 1; i <= n; i++) b[a[i]]++;
  k = n + 1;
  while (k > 0 && b[k] == 0) k--;
  s = 0;
  for (i = 0; s < n && i < n; i++)
    if (b[i])
      s += b[i];
    else {
      while (k > i && b[k] == 0) k--;
      if (b[k]) {
        b[k]--;
        ans++;
        s++;
      } else
        break;
    }
  cout << ans;
  return 0;
}
