#include <bits/stdc++.h>
using namespace std;
int n, s, x, ans, cnt = 1, a[200005];
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    i == s ? ans += x > 0 : a[x]++;
  }
  for (int i = 1; cnt < n; i++) {
    cnt += a[i] ? a[i] : 1;
    ans += a[i] == 0;
  }
  cout << ans;
}
