Orig Description
A: Test
Problem
In a classroom with $N$ seats in a straight line, $M$ students are going to take a test.
Each seat is numbered from $1 \dots N$, and one student can sit in one seat.
At this moment, each student sits in seat $A_1, \dots, A_M$.
To start the test, the following condition must be satisfied.
There must be at least one student in every seat from $1 \dots M$.
Therefore, we decided to repeat the following operation until the condition is satisfied.
Move the student who is sitting at the rearmost position to the frontmost available seat.
Find the number of operations required to satisfy the condition.
Constraints
All input values are integers.
$1 \leq N \leq 1000$
$1 \leq M \leq N$
$1 \leq A_i \leq N$
If $1 \leq i < j \leq M$, then $A_i < A_j$
Input Format
The input is given in the following format.
$N\ M$
$A_1 \dots A_M$
Output
Output the number of operations required to satisfy the condition, followed by a newline character.
Sample
Sample Input 1
6 4
1 4 5 6
Sample Output 1
2
Sample Input 2
10 3
1 2 3
Sample Output 2
0
Extracted Specification
An integer N (1 ≤ N ≤ 1000), representing some quantity or size.
An integer M (1 ≤ M ≤ N), representing some quantity or size.
A list of integers A of size M, where each integer is between 1 and N and A is in strictly increasing order.
### Example Input:
```
6 4
1 4 5 6
```
### Function Signature:
Write a function f(N, M, A) that takes in the input.
def f(N: int, M: int, A: List[int]):
'''
N: an integer
M: an integer
A: a list of integers
'''
Test Case Generator
Sure, let's create a test case generator for the given problem statement. The generator will randomly produce values for \( N \), \( M \), and the list \( A \) such that the constraints are satisfied.
Here's the test case generator in Python:
```python
import random
def tcgen():
# Generate random values for N and M such that 1 ≤ M ≤ N ≤ 1000
N = random.randint(1, 1000)
M = random.randint(1, N)
# Generate a sorted list of M unique integers from 1 to N
A = sorted(random.sample(range(1, N + 1), M))
return N, M, A
# Example usage:
N, M, A = tcgen()
print(N, M)
print(' '.join(map(str, A)))
```
### Explanation:
1. **N and M Generation**:
- The value of \( N \) is randomly chosen between 1 and 1000.
- The value of \( M \) is randomly chosen between 1 and \( N \).
2. **List A Generation**:
- We generate a list of \( M \) unique integers within the range from 1 to \( N \) using `random.sample`.
- The list \( A \) is then sorted to ensure it follows the constraint \( A_i < A_j \) for \( 1 \leq i < j \leq M \).
### Example Output:
Running the test case generator might produce output like:
```
10 3
3 6 9
```
This implies:
- \( N = 10 \)
- \( M = 3 \)
- \( A = [3, 6, 9] \)
You can run the `tcgen` function multiple times to generate different test cases.
Extract Arguments
def extract_arguments(fh):
N, M = map(int, fh.readline().strip().split())
A = list(map(int, fh.readline().strip().split()))
return N, M, A