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: Accepted)

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

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC129.C();
        }



        class ABC129
        {
            public static void A()
            {
                var X = Read.IntN().OrderBy(x => x).ToArray();
                Console.WriteLine(X.Take(2).Sum());
            }
            public static void B()
            {
                var N = Read.Int();
                var W = Read.LongN();
                var WSum = Util.ASum(W);
                long min = 1000000;
                for(int i = 0; i < N - 1; ++i)
                {
                    min = Math.Min(min, Math.Abs(WSum[i + 1] * 2 - WSum[N]));
                }
                Console.WriteLine(min);
            }
            public static void C()
            {
                var N = Read.Int();
                var M = Read.Int();
                var A = new HashSet<int>();
                for(int m = 0; m < M; ++m)
                {
                    A.Add(Read.Int());
                }
                var C = new int[N + 1];
                C[0] = 1;
                C[1] = A.Contains(1) ? 0 : 1;
                for(int i = 2; i <= N; ++i)
                {
                    C[i] = A.Contains(i) ? 0 : (C[i - 1] + C[i - 2]) % 1000000007;
                }
                Console.WriteLine(C[N]);
            }
            public static void D()
            {
                var H = Read.Int();
                var W = Read.Int();
                var S = new bool[H, W];
                for (int h = 0; h < H; ++h)
                {
                    var s = Read.Str();
                    for (int w = 0; w < W; ++w)
                    {
                        S[h, w] = s[w] == '.';
                    }
                }
                var count = new int[H, W];
                for (int h = 0; h < H; ++h)
                {
                    int L = 0, R = 0;
                    for (int w = 0; w < W; ++w)
                    {
                        count[h, w] += S[h, w] ? L : 0;
                        L = S[h, w] ? L + 1 : 0;
                    }
                    for (int w = W - 1; w >= 0; --w)
                    {
                        count[h, w] += S[h, w] ? R : 0;
                        R = S[h, w] ? R + 1 : 0;
                    }
                }
                for (int w = 0; w < W; ++w)
                {
                    int U = 0, D = 0;
                    for (int h = 0; h < H; ++h)
                    {
                        count[h, w] += S[h, w] ? U : 0;
                        U = S[h, w] ? U + 1 : 0;
                    }
                    for (int h = H - 1; h >= 0; --h)
                    {
                        count[h, w] += S[h, w] ? D : 0;
                        D = S[h, w] ? D + 1 : 0;
                    }
                }
                int max = 1;
                for (int h = 0; h < H; ++h)
                {
                    for (int w = 0; w < W; ++w)
                    {
                        max = Math.Max(max, count[h, w] + 1);
                    }
                }
                Console.WriteLine(max);
            }
            public static void E()
            {
                var L = Read.Str();
                var P = 1000000007;
                long dp1 = 1, dp0 = 1;
                for(int i = L.Length - 1; i >= 0; --i)
                {
                    dp1 = (L[i] == '1' ? (dp0 + dp1 * 2) : dp1) % P;
                    dp0 = (dp0 * 3) % P;
                }
                Console.WriteLine(dp1);
            }
        }




        class Util
        {
            public static long[] ASum(long[] array)
            {
                var res = new long[array.Length + 1];
                for (int i = 0; i < array.Length; ++i)
                {
                    res[i + 1] = res[i] + array[i];
                }
                return res;
            }
        }

        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new HashSet<int>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1]);
                    dict[ab[1]].Add(ab[0]);
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}