#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[200010];
int b[200010];
int main() {
  int ans = 0;
  cin >> n >> m;
  int k = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i == m) {
      if (a[i] != 0) a[i] = 0, ans++;
    } else if (a[i] == 0) {
      a[i] = 200005;
    }
    b[a[i]]++;
  }
  sort(a + 1, a + n + 1);
  for (int i = 0; k < n; i++) {
    if (b[i] == 0) {
      ans++;
      b[i]++;
    }
    k += b[i];
  }
  cout << ans;
  return 0;
}
