N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
mod = 10 ** 9 + 7

B = ['.'] * (N + 1) + ['#']
for a in A:
    B[a] = '#'
    
ans = 1
for i in range(N):
    if B[i] == '.':
        tmp = 0
        if B[i + 1] == '.':
            tmp += 1
        if B[i + 2] == '.':
            tmp += 1
        ans *= tmp
        ans %= mod
    
print(ans % mod)