An integer N (2 ≤ N ≤ 10^5), representing some quantity or size.
An integer M (0 ≤ M ≤ N), representing some limit on operations.
A list of integers A of size N, where each integer is between 0 and 1e5.

### Example Input:

```
5 2
0 3 2 1 4
```

### 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
    '''