#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, s, cnt[N], ps[N], fre, base;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> s;
  s--;
  fill(cnt + 1, cnt + n + 1, 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i == s && x != 0) {
      base++;
      continue;
    }
    if (i != s && x == 0) fre++;
    cnt[x] = 0;
    ps[x]++;
  }
  if (n == 1) {
    cout << base;
    return 0;
  }
  for (int i = n - 1; i >= 0; i--) ps[i] += ps[i + 1];
  int nd = 0, rtr = 1e9;
  for (int i = 1; i < n; i++) {
    nd += cnt[i];
    if (nd <= fre + ps[i + 1])
      rtr = min(rtr, fre + ps[i + 1] + base);
    else
      rtr = min(rtr, nd + base);
  }
  cout << rtr;
  return 0;
}

### Prompt

Develop a solution in Cpp to the problem described below:

There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.

There was a request to each of the workers to tell how how many superiors (not only immediate). Worker's superiors are his immediate superior, the immediate superior of the his immediate superior, and so on. For example, if there are three workers in the company, from which the first is the chief, the second worker's immediate superior is the first, the third worker's immediate superior is the second, then the third worker has two superiors, one of them is immediate and one not immediate. The chief is a superior to all the workers except himself.

Some of the workers were in a hurry and made a mistake. You are to find the minimum number of workers that could make a mistake.

Input

The first line contains two positive integers n and s (1 ≤ n ≤ 2·105, 1 ≤ s ≤ n) — the number of workers and the id of the chief.

The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ n - 1), where ai is the number of superiors (not only immediate) the worker with id i reported about.

Output

Print the minimum number of workers that could make a mistake.

Examples

Input

3 2
2 0 2


Output

1


Input

5 3
1 0 0 4 1


Output

2

Note

In the first example it is possible that only the first worker made a mistake. Then: 

  * the immediate superior of the first worker is the second worker, 
  * the immediate superior of the third worker is the first worker, 
  * the second worker is the chief. 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, s, cnt[N], ps[N], fre, base;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> s;
  s--;
  fill(cnt + 1, cnt + n + 1, 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i == s && x != 0) {
      base++;
      continue;
    }
    if (i != s && x == 0) fre++;
    cnt[x] = 0;
    ps[x]++;
  }
  if (n == 1) {
    cout << base;
    return 0;
  }
  for (int i = n - 1; i >= 0; i--) ps[i] += ps[i + 1];
  int nd = 0, rtr = 1e9;
  for (int i = 1; i < n; i++) {
    nd += cnt[i];
    if (nd <= fre + ps[i + 1])
      rtr = min(rtr, fre + ps[i + 1] + base);
    else
      rtr = min(rtr, nd + base);
  }
  cout << rtr;
  return 0;
}

```