#C6060. Alice's Fixed Jump Challenge
Alice's Fixed Jump Challenge
Alice's Fixed Jump Challenge
Alice has a unique way of moving: she can only jump exactly m units at a time. Starting from position 0, she wants to land on a series of target positions. However, because her jump length is fixed, she can only reach positions that are exact multiples of m. In other words, for each target position \(T_i\), it is necessary that \(T_i \equiv 0 \pmod{m}\).
Your task is to determine whether Alice can land exactly on all the given target positions.
Problem Details
If every target in the sequence satisfies the condition \(T_i \mod m = 0\), then Alice can reach all targets, and the answer is "YES". Otherwise, the answer is "NO".
Note: The input is provided via standard input, and your program should print the output to standard output.
inputFormat
The first line of input contains an integer m, representing the fixed jump distance.
The second line contains an integer n, the number of target positions.
The third line contains n space-separated integers, each representing a target position \(T_i\) on the number line.
Constraints: \(1 \le m \le 10^9\) and \(0 \le T_i \le 10^9\).
outputFormat
Output a single string: "YES" if Alice can land on all the target positions, otherwise "NO".
## sample2
3
2 4 6
YES