#include <bits/stdc++.h>
using namespace std;
int N, S;
int A[200005];
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> S;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i == S - 1 && A[i] != 0) {
      A[i] = 0;
      ans++;
    }
  }
  sort(A, A + N);
  int maxCnt = 0, canChange = 0, idx = N - 1;
  for (int i = 1; i < N; i++) {
    if (A[i] == 0) {
      canChange++;
      ans++;
    } else {
      while (A[i] > maxCnt + 1 && canChange > 0) {
        maxCnt++;
        canChange--;
      }
      while (A[i] > maxCnt + 1 && idx >= i) {
        A[idx] = maxCnt + 1;
        maxCnt++;
        idx--;
        ans++;
      }
      maxCnt = max(maxCnt, A[i]);
    }
  }
  cout << ans << "\n";
  return 0;
}
