#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, x = 0;
  cin >> n >> s;
  int a[n];
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int ans = 0;
  if (a[s - 1] != 0) {
    ans++;
    a[s - 1] = 0;
  }
  sort(a, a + n);
  int i = 1;
  int m = 0;
  int wrong = 0;
  for (i = 1; i < n; ++i) {
    if (a[i] != 0) {
      break;
    }
    wrong++;
    ans++;
  }
  int e = n - 1;
  for (i; i <= e;) {
    if (a[i] <= m + 1) {
      m = max(m, a[i]);
      ++i;
    } else if (wrong) {
      wrong--;
      m++;
    } else if (a[i] > m + 1) {
      while (e >= i && a[i] > m + 1) {
        ++m;
        --e;
        ans++;
      }
    }
  }
  cout << ans << endl;
}
