N, M = map(int,input().split())
data = []
for i in range(M):
    data.append(int(input()))
bef = 0
for i in data:
    if bef + 1 == i:
        print(0)
        exit()
    bef = i
print(int(2 ** ((N - M * 2) / 2)) % 1000000007)