n, m = map(int,input().split())
broken = [0] + [int(input()) for i in range(m)] + [n]
l = []

for i in range(m + 1):
    if broken[i] != 0 and broken[i + 1] - broken[i] == 1:
        exit()
    else:
        dif = broken[i + 1] - (broken[i] + 1)
        l.append(int(-(-(dif / 2 + 1))))

ans = 1

for i in l:
    ans *= i
    
print(ans % 1000000007)