N, M = list(map(int, input().split(" ")))
A = [0] * (N+1)
for i in range(M):
    A[int(input())] = -1
count = 0
for i in reversed(range(N + 1)):
    if(i - 2 >= 0 and A[i - 2] != -1 and A[i - 1] != -1 and A[i] != -1):
        count += 1
    if(i - 2 >= 0 and (A[i - 2] == -1 and A[i - 1] == -1) ):
        count = -1
        break
if(count == -1):
    print(0)
else:
    print(pow(2,count, 100000007))
