#include <bits/stdc++.h>
using namespace std;
long long pow(long long a, long long b, long long M) {
  long long t = 1;
  for (a %= M; b; b >>= 1) {
    if (b & 1) t = t * a % M;
    a = a * a % M;
  }
  return t;
}
int n, s, a[222222], ans;
set<int> q;
int main() {
  cin >> n >> s;
  for (int i = 1; i <= int(n); i++) scanf("%d", &a[i]);
  if (a[s] != 0) ans++, a[s] = 0;
  for (int i = 0; i <= int(n - 1); i++) q.insert(i);
  for (int i = 1; i <= int(n); i++)
    if (q.count(a[i])) q.erase(a[i]);
  for (int i = 1; i <= int(n); i++)
    if (a[i] == 0 && i != s) a[i] = *q.begin(), q.erase(a[i]), ans++;
  sort(a + 1, a + n + 1);
  for (int i = n; i >= int(1); i--)
    if (!q.empty() && a[i] > *q.begin())
      a[i] = *q.begin(), q.erase(q.begin()), ans++;
  cout << ans;
}
