#include <bits/stdc++.h>
using namespace std;
const int maxn = 300005;
int a[maxn], level[maxn];
int main() {
  int n, chief;
  cin >> n >> chief;
  int ret = 0, cur = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i == chief) {
      if (a[i] > 0) ret++;
    } else
      level[a[i]]++;
  }
  for (int i = 1; i < n; i++) {
    if (level[i])
      cur += level[i];
    else {
      cur++;
      ret++;
    }
    if (cur >= n) break;
  }
  cout << ret << endl;
}
