An integer N (1 ≤ N ≤ 1000), representing some quantity or size.
An integer M (0 ≤ M ≤ N), representing another quantity or threshold.
An integer A (1 ≤ A ≤ 1000), representing a threshold.
An integer B (1 ≤ B ≤ 1000), representing another threshold.
A list of integers D of size N, where each integer is between 1 and 1000.

### Example Input:

```
5 3 6 9
9 7 5 3 1
```

### Function Signature:
Write a function f(N, M, A, B, D) that takes in the input.
```python
def f(N: int, M: int, A: int, B: int, D: List[int]):
    '''
    N: an integer
    M: an integer
    A: an integer
    B: an integer
    D: a list of integers
    '''
```