Problem:
Score : 300 points

Problem Statement

There is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.
He can climb up one or two steps at a time.

However, the treads of the a_1-th, a_2-th, a_3-th, \ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.

How many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?
Find the count modulo 1\ 000\ 000\ 007.

Constraints

1 \leq N \leq 10^5

0 \leq M \leq N-1

1 \leq a_1 < a_2 < ... < a_M \leq N-1

Input

Input is given from Standard Input in the following format:

N M
a_1
a_2
.
.
.
a_M

Output

Print the number of ways to climb up the stairs under the condition, modulo 1\ 000\ 000\ 007.

Sample Input 1

6 1
3

Sample Output 1

4

There are four ways to climb up the stairs, as follows:

0 \to 1 \to 2 \to 4 \to 5 \to 6

0 \to 1 \to 2 \to 4 \to 6

0 \to 2 \to 4 \to 5 \to 6

0 \to 2 \to 4 \to 6

Sample Input 2

10 2
4
5

Sample Output 2

0

There may be no way to climb up the stairs without setting foot on the broken steps.

Sample Input 3

100 5
1
23
45
67
89

Sample Output 3

608200469

Be sure to print the count modulo 1\ 000\ 000\ 007.

Solution in C# (Mono 4.6.2.0) (judge verdict: Time Limit Exceeded)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{

	public static void Main(string[] args)
	{
	

		
		kekka.Add(10 ,89);
		kekka.Add(11 ,144);
		kekka.Add(12 ,233);
		kekka.Add(13 ,377);
		kekka.Add(14 ,610);
		kekka.Add(15 ,987);
		kekka.Add(16 ,1597);
		kekka.Add(17 ,2584);
		kekka.Add(18 ,4181);
		kekka.Add(19 ,6765);
		kekka.Add(20 ,10946);
		kekka.Add(21 ,17711);
		kekka.Add(22 ,28657);
		kekka.Add(23 ,46368);
		kekka.Add(24 ,75025);
		kekka.Add(25 ,121393);
		kekka.Add(26 ,196418);
		kekka.Add(27 ,317811);
		kekka.Add(28 ,514229);
		kekka.Add(29 ,832040);
		kekka.Add(30 ,1346269);
		kekka.Add(31 ,2178309);
		kekka.Add(32 ,3524578);
		kekka.Add(33 ,5702887);
		kekka.Add(34 ,9227465);
		kekka.Add(35 ,14930352);
		kekka.Add(36 ,24157817);
		kekka.Add(37 ,39088169);
		kekka.Add(38 ,63245986);
		kekka.Add(39 ,102334155);
		kekka.Add(40 ,165580141);
		kekka.Add(41 ,267914296);
		kekka.Add(42 ,433494437);
		kekka.Add(43 ,701408733);
		kekka.Add(44 ,1134903170);
		kekka.Add(45 ,1836311903);
		
		/*
				for(int i = 50; i<100;i++)
		{
			Console.WriteLine("kekka.Add("+i+" ,"+CountPattern(i)+");");
		}
		*/

		string[] s = Console.ReadLine().Split(' ');
		int n = int.Parse(s[0]);
		int m = int.Parse(s[1]);
		
		bool[] a = new bool[n];
		int last = -10;
		int q = 0;
		long ppp = 1;
		for(int i = 0; i < m; i++)
		{
			int index = int.Parse(Console.ReadLine());
			if(index == last+1) {
				Console.WriteLine(0);
				return;
			}
			a[index]=true;
			
			int o = Math.Max(0,last+1);
			if(index-o-1>1)
			{
				q = (index-1-o);
				ppp *= CountPattern(q);
				ppp %= 1000000007;
			}
			last = index;
		}
		q = (n-Math.Max(0,last+1));
		if(q>1)
		{
			ppp *= Math.Max(1,CountPattern(q));
		
		}
		
		
		Console.WriteLine(ppp%1000000007);
	
		
	}
	public static int count;
	public static Dictionary<int,long> kekka = new Dictionary<int,long>();
	public static long CountPattern(int n)
	{
		count = 0;
		if(kekka.ContainsKey(n))
			return kekka[n];
		C(0, n);
		kekka.Add(n,count);
		return count;
	}
	
	public static void C(int p, int n)
	{
		A(p,n);
		B(p,n);
	}
	
	public static bool A(int p, int n)
	{
		p+=2;
		
		if(p==n) {
			count++;
			return true;
		}
		if(p<n) {
			C(p,n);
		}
		return false;
	}
	
	public static bool B(int p, int n)
	{
		p+=1;
		if(p==n) {
			count++;
			return true;
		}
		if(p<n) {
			C(p,n);
		}
		return false;
	}

	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

	
}