n,m = map(int,input().split())
MOD = 10**9 + 7

q = [1,2]
append = q.append
for i in range(10**5+10):
    if i >= 2:
        t = q[i-1]+q[i-2]
        t%= MOD
        append(t)
ans = 1
a_pre = 0
for i in range(m+1):
    if i == m:
        if a_now == n-1:
            print(0)
            exit()
        else:
            ans *= q[n-a_now-2]
            ans %=MOD
            break
    if i>0:
        a_pre = a_now
    a_now = int(input())
    if i == 0:
        if a_now != 1:
            ans*=q[a_now-2]
            ans%=MOD
    if i>0:
        if a_pre + 1 == a_now:
            print(0)
            exit()
        else:
            if a_now-a_pre-3!=-1:
                ans*=q[a_now-a_pre-3]
            ans %=MOD

print(ans)