import re
import sys
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    numerator = reduce(mul, range(n, n - r, -1))
    denominator = reduce(mul, range(1, r + 1))
    return numerator // denominator


def Step(num):
    ans = 0
    for i in range(num//2 + 1):
        ans += cmb(num-i, i)
    return ans


N, M = map(int, input().split())
a = list(map(int, sys.stdin))

if M > 0:
    step = ['1']*N
    for i in range(M-1):
        if a[i]+1 == a[i+1]:
            print(0)
            exit()
        else:
            step[a[i]-1] = step[a[i]] = '2'
    step[a[M-1]-1] = step[a[M-1]] = '2'
elif M == 0:
    print(Step(N) % 1000000007)
    exit()

one_one = list(map(len, re.findall(r'1+', ''.join(step))))
ans = 1
for i in one_one:
    ans *= Step(i)

print(ans % 1000000007)
