#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
inline bool REMIN(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool REMAX(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
int toint(const string &s) {
  stringstream ss;
  ss << s;
  int x;
  ss >> x;
  return x;
}
string tostring(int number) {
  stringstream ss;
  ss << number;
  return ss.str();
}
const int INF = INT_MAX;
const int NMAX = 1000004;
const long long MOD = 1000000007;
const long double PI = 2 * acos(0);
int T, N, M, S;
int a, b;
string s;
int lc[2 * NMAX];
int llas, lm;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, s;
  cin >> n >> s;
  --s;
  vector<int> v(n);
  int ans = 0, free = 0;
  vector<int> d;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (i == s && v[i] != 0) {
      ++ans;
    }
    if (i == s) {
      continue;
    }
    if (v[i] == 0) {
      ++ans;
      ++free;
      continue;
    }
    d.push_back(v[i]);
  }
  sort(d.begin(), d.end());
  int mxDepth = 0;
  for (int i = 0; i < (int)d.size();) {
    if (d[i] <= mxDepth + 1) {
      mxDepth = max(d[i], mxDepth);
      ++i;
    } else if (free) {
      --free;
      ++mxDepth;
    } else {
      d.pop_back();
      ++ans;
      ++mxDepth;
    }
  }
  cout << ans << "\n";
  return 0;
}
