import math

def fib(n):
    f = (((1 + math.sqrt(5)) / 2)**n - ((1 - math.sqrt(5)) / 2)**n ) / math.sqrt(5)
    return int(f)


NM = [int(i) for i in input().split()]
a = []
b = []
answer = 0
flag = True
for i in range(NM[1]):
    a.append(int(input()))
    if(i == 0):
        if(a[i] - 1 != 0):
            b.append(a[i] - 1)
        if(a[i] - 1 < 0):
            flag = False
    else:
        if(a[i] - a[i - 1] - 2 != 0):
            b.append(a[i] - a[i - 1] - 2)
        if(a[i] - a[i - 1] - 2 < 0):
            flag = False

    if(i == NM[1] - 1):
        if(NM[0] - a[i] - 1 != 0):
            b.append(NM[0] - a[i] - 1)
        if(NM[0] - a[i] - 1 < 0):
            flag = False

if(NM[1] > NM[0]/2):
    answer = 0
elif(not flag):
    answer = 0
else:
    sum = 1
    for i in range(len(b)):
        sum *= fib(b[i] + 1)
        sum = sum % (10**9 + 7)
    answer = sum
print(answer)
