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

namespace AtCoder
{
    class Program
    {
        static int M;
        static long[] moves;
        static long ans;
        static int lower;
        static int upper;

        static void Main(string[] args)
        {
            //[summary]C - Typical Stairs
            var line = ReadLine();
            int N = line[0];
            M = line[1];

            var floors = GetBrokenFloors(M);

            if (!CanPass(floors))
            {
                Console.WriteLine(0);
            }
            else
            {
                moves = new long[N];
                moves[1] = 1;
                ans = 1;
                lower = 0;

                while (floors.Count > 0)
                {
                    var a = floors.Dequeue();
                    upper = a - 1;

                    Move();
                }

                //最後に、ゴールまで登る
                upper = N;
                Move();

                Console.WriteLine(ans);
            }
        }

        static void Move()
        {
            long count = 0;

            if (lower <= upper)
            {
                int stairs = upper - lower;
                count += Count(stairs);

                if (count > 0)
                {
                    ans = ans * count % 1000000007;
                }                
            }
            
            lower = upper + 2;
        }

        static long Count(int stairs)
        {
            if (moves[stairs] == 0)
            {
                int i = 1;
                long m = 0;

                while (i * 2 <= stairs)
                {
                    m += CountCombinations(stairs, i);
                    i++;
                }

                moves[stairs] = m;
            }
            
            return moves[stairs];
        }

        static long CountCombinations(int n, int r)
        {
            //[summary]組み合わせの数 nCr を計算
            //(n種類の中から、r種類を選ぶ)
            long ans = 1;

            for (int i = 1; i <= r; i++)
            {
                ans = ans * (n - i + 1) / i;
            }

            return ans;
        }

        static bool CanPass(Queue<int> floors)
        {
            var a = floors.ToArray();

            if (M > 1)
            {
                for (int i = 0; i < M - 1; i++)
                {
                    if (a[i] + 1 == a[i + 1])
                    {
                        return false;
                    }
                }
            }

            return true;
        }

        static Queue<int> GetBrokenFloors(int M)
        {
            var floors = new Queue<int>();

            for (int i = 0; i < M; i++)
            {
                int a = int.Parse(Console.ReadLine());
                floors.Enqueue(a);
            }

            return floors;
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}