# -*- coding: utf-8 -*-
import sys

N, M = map(int, input().split())
a = [int(input()) for x in range(M)]

def calc_routes(dan):
    tmp = 1
    for i in range(int(dan/2)):
        i += 1
        n = dan - i
        tmp2 = 1
        for j in range(i):
            tmp2 *= n - j
        for j in range(i):
            tmp2 /= j + 1
        tmp += tmp2

    return tmp


for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        print(0)
        sys.exit()

routes = 1
prev = 0
for x in a:
    x -= 1
    dan = x - prev
    routes *= calc_routes(dan)
    routes %= 1000000007
    prev = x+2

routes *= calc_routes(N-prev)
routes %= 1000000007
print(int(routes))