P26949 [AtCoder] Lying Students
NOI
题目描述

Problem Description

$ N $ students took a test and each received a score that is an integer between $ 0 $ and $ P $ inclusive. The scores of each student are distinct, and they are ranked in descending order based on their scores.

Takahashi asked each student about their score, and the $ i $-th ranked student said their score was $ A_i $ points. However, some of the students might be lying.

Determine the minimum number of students who are lying.

Input Format

The input is given from the standard input in the following format:

$ N $ $ P $ $ A_1 $ $ A_2 $ $\ldots$ $ A_N $

Output Format

Output the minimum number of students who are lying.

Sample Input and Output

Sample Input #1

5 10
7 5 10 3 2

Sample Output #1

1

Sample Input #2

5 10
9 8 7 7 5

Sample Output #2

1

Sample Input #3

11 1000000000
0 1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000

Sample Output #3

10

Notes/Hints

Constraints

  • $2 \leq N \leq 2 \times 10^5$
  • $N-1 \leq P \leq 10^9$
  • $0 \leq A_i \leq P$
  • All values in the input are integers.

Sample Explanation 1

Only the 3rd-ranked student is lying, and if the 3rd-ranked student's actual score was 4 points, the scores and ranks would match. If all students were telling the truth, the 3rd-ranked student's score would be higher than the 2nd-ranked student's score, which is impossible. Therefore, the minimum number of students lying is 1.

Sample Explanation 2

The actual scores of the students are distinct.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 10 7 5 10 3 2
样例输出
1