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
Sample 1
Input
5 0
1 3 5 2 4
Output
8
Sample 2
Input
6 1
6 2 5 1 4 3
Output
2
Sample 3
Input
6 2
1 2 3 4 5 6
Output
3