#include <bits/stdc++.h>
using namespace std;
template <class T, class L>
inline bool smax(T &x, L y) {
  return x < y ? (x = y, 1) : 0;
}
template <class T, class L>
inline bool smin(T &x, L y) {
  return y < x ? (x = y, 1) : 0;
}
const int maxn = 2e5 + 17;
int n, s, a[maxn], shit, ans = 1e9, num[maxn];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  int bb = 0;
  if (a[s - 1] != 0) a[s - 1] = 0, shit++;
  if (count(a, a + n, 0) > 1) {
    sort(a, a + n, greater<int>());
    int c = count(a, a + n, 0);
    n -= c - 1;
    shit += c - 1;
    bb += c - 1;
  }
  for (int i = 0; i < n; i++) num[a[i]]++;
  int seen = 0, bad = 0;
  for (int h = 0; h < maxn; h++) {
    seen += num[h];
    bad += !num[h];
    smin(ans, max(n - seen, bad - bb));
  }
  cout << ans + shit << '\n';
  return 0;
}
