N,M = map(int, input().split())
a = [0]*(M+1)
for i in range(M): a[i] = int(input())
a[M] = N+1

inf = 10**9+7

def comb(cur,ai):
    if ai - cur == 1:
        return 1
    elif ai - cur == 2:
        return 2
    elif ai <= cur:
        return 0
    return((comb(cur, ai-1)+comb(cur,ai-2))%inf)

cur = 0
if a[0] == 1: cur += 2
cnt = 1
for i in range(M+1):
    if a[0] == 1 and i == 0: continue
    if cur == a[i]:
        cnt = 0
        break
    cnt *= comb(cur,a[i]-1)%inf
    cnt = cnt%inf
    cur = a[i]+1

print(cnt%inf)
