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

namespace ABC129_C
{
    class Program
    {
        static long[] fibo = new long[100001];
        static void Main(string[] args)
        {
            var mod = 1000000007;
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = new int[NM[1]];
            var imp = false;
            for (int i = 0; i < NM[1]; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
                if (i>0 && a[i]-a[i-1]==1)
                {
                    imp = true;
                }
            }

            if (imp)
            {
                Console.WriteLine(0);
            }
            else
            {
                long ans = 0;
                var temp = 0;
                foreach (var i in a)
                {
                    if (ans ==0)
                    {
                        ans += CalcFibo(i - 1 - temp);
                    }
                    else
                        ans *= CalcFibo(i-1 - temp);
                    ans %= mod;

                    temp = i + 1;
                }

                if (ans == 0)
                {
                    ans += CalcFibo(NM[0] - temp);
                }
                else
                    ans *= CalcFibo(NM[0] - temp);
                ans %= mod;

                Console.WriteLine(ans);
            }
        }

        static long CalcFibo(int n)
        {
            if (n <= 1) return 1;
            if (fibo[n] != 0) return fibo[n];
            fibo[n] = CalcFibo(n - 1) + CalcFibo(n - 2);
            
            return fibo[n];
        }
    }
}
