#include <bits/stdc++.h>
using namespace std;
const int Nmax = 2 * 1e5 + 1;
int n, s, v[Nmax], cnt[Nmax];
int main() {
  cin >> n >> s;
  int rem = 0;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    if (i == s) {
      if (v[i] != 0) {
        rem++;
        v[i] = -1;
      }
    } else
      cnt[v[i]]++;
  }
  rem += cnt[0];
  sort(v + 1, v + n + 1);
  for (int i = 1; i < v[n]; i++) {
    if (cnt[i] == 0) {
      if (cnt[0] == 0)
        n--, rem++;
      else
        cnt[0]--;
    }
  }
  cout << rem << '\n';
  return 0;
}
