#include <bits/stdc++.h>
using namespace std;
int seq[200005], sum[200005], n, s, cur;
int main() {
  scanf("%d%d", &n, &s);
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &seq[i]);
    if (i == s && seq[i])
      seq[i] = 0, cur++;
    else if (i != s && !seq[i])
      ans++;
  }
  sort(seq + 1, seq + 1 + n);
  for (int i = 1; i <= n; ++i)
    sum[i] = max(seq[i] - seq[i - 1] - 1, 0) + sum[i - 1];
  for (int i = n; i >= 1; --i)
    if (sum[i] <= ans + (n - i)) return printf("%d\n", ans + (n - i) + cur), 0;
  return 0;
}
