#P5539. 【XR-3】Unknown Mother-Goose
【XR-3】Unknown Mother-Goose
Problem Description
Xiao X is given a positive integer and a set of positive integers . He wants to know how many positive integers satisfy all of the following conditions:
- There exists such that
- There exists such that
- There exists such that
Please help Xiao X compute the answer.
Input Format
The first line contains two positive integers , representing the given and the size of the set .
The second line contains positive integers, representing the elements in the set .
Constraints:
- .
- .
- All elements in are less than . Elements are not guaranteed to be distinct.
Output Format
Output one integer in a single line, representing the answer.
10 3
2 4 5
1
100000 6
14 47 31 233 666 59
91
Hint
[Sample Explanation]
Only when :
do the conditions hold.
Translated by ChatGPT 5