import math
N,M = map(int,input().split(" "))
a = []
for i in range(M):
    a.append(int(input()))
#print(a)

NG_FLAG1 = 0
for i in range(M-1):
    if a[i+1] - a[i] == 1:
        NG_FLAG1 = 1

if NG_FLAG1 == 1:
    print(0)
else:   
    STEP = [0] * N
    for i in range(M):
        STEP[a[i]-1] = "x"
    #print(STEP)
    comb_list = []
    comb_count = 0
    for i in range(N):
        if STEP[i] == "x":
            comb_list.append(comb_count)
            comb_count = 0
        elif STEP[i] == 0:
            comb_count += 1
            if i == N-1:
                comb_list.append(comb_count)
        #print(i)
    #print(comb_list)
    """
    for i in range(len(comb_list)):
        comb_list[i] = math.floor(comb_list[i]/2) + 1
    print(comb_list)"""
    def permutations_count(n, r):
        return math.factorial(n) // math.factorial(n - r)
    def stepper(step_num):
        looper = math.floor(step_num/2) + 1
        calc = 0
        for j in range(looper):
            calc += permutations_count(step_num, step_num - (j+2))
            step_num -= 2
        return calc

    ans = 0
    for i in range(len(comb_list)):
        cf = stepper(comb_list[i])
        ans += cf
    print(ans%1000000007)