import math
import sys
input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    A = [-1] + [int(input()) for _ in range(M)] + [N+1]
    for i in range(1, M):
        if A[i+1] - A[i] == 1:
            print(0)
            exit()
    ans = 1
    mod = 10 ** 9 + 7
    for i in range(M+1):
        d = A[i+1] - A[i] - 2
        if d <= 0:
            continue
        comb_sum = 0
        for freq_of_2 in range((d // 2) + 1):
            freq_of_1 = d - 2 * freq_of_2
            comb_sum += int(math.factorial(freq_of_2 + freq_of_1) / (math.factorial(freq_of_1) * math.factorial(freq_of_2)))
        ans = (ans * comb_sum) % mod
    print(ans)


if __name__ == '__main__':
    main()
