n,m = map(int,input().split(" "))
a=[]
ans = 1
for i in range(m):
    a.append(int(input()))
    if a[i]-1 == a[i-1]:
        ans = 0
if ans == 1:
    t,w,v = 0,0,0
    for j in range(len(a)):
        if j+1 == m:
            if n-a[j] >= 3:
                v += 1
                w += n-a[j]
            break
        elif a[j] - t >= 3:
            v += 1
            w += a[j] - t
            t = a[j] + 1
        else:
            t = a[j] + 1
ans = v * 2
t = ans // 2
for k in range(w):
    temp = ans
    ans += t
    t = temp

print(ans % 1000000007)
