
# coding: utf-8
N, M = map(int, input().split())
a = []
for i in range(M):
    a.append(int(input()))
a.append(N+1)
#print("a", a)

out = 1
t = 0

while(t<N):
    if t+1 in a:
        if t+2 in a: # x x
            #print("d")
            out = 0
            break
        else: # x o
            #print("c")
            #out *= 1
            t += 2
    else:
        if t+2 in a: # o x
            #print("b")
            #out *= 1
            t += 1           
        else: # o o
            #print("a")
            out = out * 2
            t += 2            
    #print(t, out)
    #out = out%1000000007
print(out%1000000007)
