N, M = map(int, input().split())
MOD = 1000000007

A = []
for i in range(M):
    A.append(int(input()))

ans = 0
for i in range(2, N+1):
    if i in A:
        continue
    if i - 2 in A and i - 1 in A:
        print(0)
        exit()
    if i - 2 not in A and i - 1 not in A:
        ans += 1

print(2 ** ans % MOD)

