#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 1e9;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
template <typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& a) {
  for (int i = 0; i < a.size(); ++i) in >> a[i];
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> a) {
  for (int i = 0; i < a.size(); ++i)
    if (i == a.size() - 1)
      out << a[i];
    else
      out << a[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  cin >> a;
  x--;
  int ans = 0;
  if (a[x] != 0) a[x] = 0, ans++;
  for (int i = 0; i < n; i++)
    if (a[i] == 0 && x != i) a[i] = n;
  multiset<int> s;
  for (int i = 0; i < n; i++) s.insert(a[i]);
  int cur = 1;
  while (cur < *(--s.end())) {
    if (s.count(cur)) {
      cur++;
      continue;
    }
    s.erase(--s.end());
    s.insert(cur);
    ans++;
    cur++;
  }
  cout << ans << endl;
  return 0;
}
