using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace SolutionCS
{
    class Program
    {
        class modMCalc
        {
            public const int M = 1000000007;       // 素数(int範囲)

            // 乗算結果 % Mを求める
            static public int Mul(int a, int b)
            {
                return (int)(Math.BigMul(a, b) % M);
            }

            // 冪乗(mod M)
            static public int Pow(int a, int m)
            {
                if (0 == m)
                {
                    return 1;
                }
                if (1 == m)
                {
                    return a;
                }

                int result = 1;
                int param = a;
                for (; m > 0; m >>= 1)
                {
                    if ((m & 0x01) == 1)
                    {
                        result = Mul(result, param);
                    }

                    param = Mul(param, param);
                }

                return result;
            }

            // 除算(mod M)
            static public int Div(int a, int b)
            {
                return Mul(a, Pow(b, M - 2));
            }
        }

        class CombinationPermutation
        {
            private readonly int[] fac;

            // コンストラクタ
            // (mod Mの)階乗テーブル作成する
            public CombinationPermutation(int n)
            {
                fac = new int[n + 1];
                fac[0] = 1;
                for (int i = 1; i <= n; ++i)
                {
                    fac[i] = modMCalc.Mul(fac[i - 1], i);
                }
            }

            // 階乗求める
            public int Factorial(int n)
            {
                return fac[n];
            }

            // nCr
            public int nCr(int n, int r)
            {
                if (n < r) { return 0; }
                if (n == r) { return 1; }
                int res = Factorial(n);
                res = modMCalc.Div(res, Factorial(r));
                res = modMCalc.Div(res, Factorial(n - r));
                return res;
            }
        }

        static void Main(string[] args)
        {
            string[] inS = Console.ReadLine().Split(' ');
            int N = int.Parse(inS[0]);
            int M = int.Parse(inS[1]);

            int[] b = new int[M+2];

            b[0] = -1;
            for (int i = 0; i < M; i++)
            {
                b[i+1] = int.Parse(Console.ReadLine());

                // 一番最初以外が連続していたら終了
                if ( i != 0 && (b[i] + 1 == b[i+1]) )
                {
                    Console.WriteLine(0);
                    return;
                }
            }
            b[M+1] = N + 1;

            CombinationPermutation c = new CombinationPermutation(N);

            int ans = 1;

            for (int i = 0; i <= M; i++)
            {
                int p = 1;
                int w = b[i + 1] - b[i] - 2;

                int s = w -1;
                int d = 1;

                while(s >= d)
                {
                    int a;
                    a = c.nCr(s, d);
                    p += a;
                    p %= modMCalc.M;
                    s -= 1;
                    d += 1;
                }

                ans = modMCalc.Mul(ans, p);
            }


            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13280