#include <bits/stdc++.h>
using namespace std;
int a[200005 + 2], us[200005 + 2];
int main() {
  ios_base::sync_with_stdio(0);
  int n, s, res = 0;
  cin >> n >> s;
  for (int i = 0; i < n; ++i) cin >> a[i];
  if (a[s - 1] != 0) a[s - 1] = 0, res += 1;
  us[0] = 1;
  for (int i = 0; i < n; ++i)
    if (a[i] == 0 && i != s - 1) a[i] = n;
  sort(a, a + n);
  int counter = 0;
  int cx = 0;
  for (int i = 0; i < n - cx; ++i) {
    if (us[i]) continue;
    if (a[i] == counter) {
      continue;
    } else {
      counter += 1;
      if (a[i] != counter) {
        a[n - cx - 1] = counter;
        res += 1;
        cx += 1;
        i -= 1;
      }
    }
  }
  cout << res << endl;
}
