#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 1;
int n, s;
int a[mxn], c[mxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == 0 && i != s) a[i] = n;
    c[a[i]]++;
  }
  int ans = 0;
  if (a[s]) {
    ans++;
    c[a[s]]--;
    a[s] = 0;
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= a[n]; i++) {
    if (c[i] == 0) {
      ans++;
      n--;
    }
  }
  cout << ans;
}
