Positive integers and a sequence of length are given. The sequence satisfies the following conditions.
- ().
- ().
Find the number of integer pairs that satisfy the following conditions.
- .
- There exist exactly integers such that and .
Input
The input is given in the following format.
Output
Print the answer on the first line.
Constraints
- .
- .
- ().
- ().
Subtasks
Samples
예제 1
입력
5 0
1 3 5 2 4
출력
8
예제 2
입력
6 1
6 2 5 1 4 3
출력
2
예제 3
입력
6 2
1 2 3 4 5 6
출력
3