import sys
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


def getcase(y):
    total = 0
    for j in range(y//2+1):
        total +=cmb(j+y-2*j,j)
    return total


N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
for i in range(len(a)-1):
    if a[i]+1 == a[i+1]:
        print(0)
        sys.exit()

k =[a[0]-1]
for i in range(len(a)-1):
    k.append(a[i+1]-a[i]-2)
k.append(N-a[-1]-1)
ans = 1
# print(k)
for g in k:
    ans *= getcase(g)
    ans = ans%1000000007
print(int(ans%1000000007))
