n,m = map(int, input().split())
e = 10*9 + 7
c = 0
ans = 1
for _ in range(m):
    a = int(input())
    b = a-1-c
    if b < 0:
        ans *= 0
        break
    c = a+1
    print(sum([i for i in range(-(-b//2), b)]))
    ans *= (1 + sum([i for i in range(-(-b//2), b)])) % e
    
b = n - c
ans *= (1 + sum([i for i in range(-(-b//2), b)])) % e
print(ans)