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

AAA = [0]
for i in range(M):
    AAA.append(int(input()))
AAA.append(N)

ans = 1
for i in range(len(AAA)-1):

    mitinori = AAA[i+1] - AAA[i]

    if mitinori == 1 and i != 0:
        print(0)
        exit()

    if mitinori >= 2:
        ans *= 2**(mitinori-2)

print(ans % 1000000007)
