N,M = map(int,input().split())
A = [int(input()) for i in range(M)]
A.append(N+1)
out = 1
s = [1,2]
if A[0] != 1:
    hoge = [A[0]-2]
else:
    hoge = []

for i in range(N-M):
    s.append(s[i]+s[i+1])

for k in range(M):
    if A[k+1]-A[k]-2 != int(-1):
        hoge.append(A[k+1]-A[k]-3)
    else:
        out = 0
        break

print(hoge)

for j in hoge:
    out *= s[j]
    out = out%10000000007

print(out%10000000007)