#!/usr/bin/env python3
from scipy.special import comb


def stair(r):
    con = 0
    for i in range(r // 2 + 1):
        con += comb(r - i, i, exact=True)
    return con


n, m, *a = map(int, open(0).read().split())
if sum(a[i + 1] == a[i] + 1 for i in range(m - 1)) > 0:
    print(0)
    exit()

a.append(n+1)
c = -1
ans = 1
for i in a:
    ans = ans * stair(i - c - 2) % (10**9 + 7)
    c = i
print(ans)
