using System;
using System.Collections.Generic;

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

        int[] A = new int[M+2];
        A[0] = 0;
        for (int i = 1; i < M+1; i++)
        {
            A[i] = int.Parse(Console.ReadLine());
            if(i>1 && A[i-1]+1==A[i])
            {
                Console.WriteLine(0);
                return;
            }
        }
        A[M+1] = N;

        long sum = 1;
        for (int i = 1; i < A.Length; i++)
        {
            int step = A[i] - A[i-1] - 1;
            if (M != 0)
            {
                if (i != 0 && i != M + 1) step -= 1;
            }
            else
            {
                step += 1;
            }
            if (step <= 0) continue;

            long pattern = 0;
            int up2 = 0;
            while(up2 * 2 <= step)
            {
                int n = step - up2;
                int k = up2;

                long c = Combination(n, k);
                pattern += c;
                up2++;
            }
            sum *= pattern;
        }

        Console.WriteLine(sum % 1000000007L);
    }

    static long Combination(int n, int k)
    {
        if (n == k || k == 0) return 1L;
        return Factorial(n, n-k+1) / Factorial(k, 1);
    }

    static long Factorial(int n, int k)
    {
        if(n==0) return 1L;
        if(n==k) return n;
        return n * Factorial(n-1, k);
    }
}