import sys
from math import factorial
#nCi
def com(n, i):
    return int(factorial(n)/factorial(i)/factorial(n-i))
    
def cal1(num):
    total = 1
    if num < 1: return total
    if num == 1: return 2
    large_num = num
    for small_num in range(1, num):
        if small_num > large_num: break
        total += com(large_num, small_num)
        large_num -= 1
    return total

def main():
    N, M = map(int, input().split())
    len_list = []
    pre_a = -1
    for m in range(M):
        a = int(input())
        if (pre_a + 1) == a: sys.exit("0")
        len_list.append(a-(pre_a+3))
        pre_a = a
    len_list.append(N-(pre_a+2))
    ans = 1
    for num in len_list:
        ans *= cal1(num)
    print(ans%1000000007)
    
main()