PROBLEM I: CLIMBING FAIRY MOUNTAIN

View as PDF

Submit solution

Points: 50.00
Time limit: 1.0s
Memory limit: 256M
Input: stdin
Output: stdout

Author:
Suggester:
Problem type

To meet the needs of tourists experiencing the feeling of climbing to the top of Co Tien Mountain to see the whole view of Nha Trang, Bac Nha Trang Ward has built stairs from the foot of the mountain to the top of Co Tien Mountain, including N steps. On a beautiful day, Bom wanted to experience climbing to the top of Co Tien Mountain to see the scenery, but unfortunately, the night before, Bac Nha Trang had a heavy rain that made K steps slippery and unable to set foot on them (The Nth step on the top is the safe step). Because Bom was tired, Bom could only take one or a maximum of two steps at a time. Just as he was about to step up the steps, Bom suddenly asked a question, how many ways are there to step from the foot of the mountain to the top of the mountain.

Input: From the standard device in the form:

  • The first line contains 2 positive integers N, K separated by a space (1 ≤ N ≤ ~10^5~, 0 ≤ K ≤ N);
  • The second line contains K positive integers ~b_1, b_2, …, b_K~ ~(1 ≤ b_i < N)~ which are the numbers of broken steps, each separated by a space.

Output: A single integer which is the number of steps from the foot of the mountain to the top of the mountain. Since the number of steps can be very large, we only take the remainder when dividing by ~10^7~.

Exam:

Input

5 1
2

Output
2

Explain

Cách 1: 1 -> 3 -> 4 -> 5
Cách 2: 1 -> 3 -> 5


Comments

Please read the guidelines before commenting.


There are no comments at the moment.