import sys

n,m=map(int,input().split())
A=[int(input()) for __ in range(m)]
bef=0
ans=0
fib=[0,2,3]

dist=[]
for a in A:
    if a-bef-1 == 0 and a != 1:
        print(0)
        sys.exit()
    else:
        dist.append(a-bef-1)
    bef=a
dist.append(n-bef-1)
print(dist)

for a in dist:
    if len(fib)<=a:
        for i in range(len(fib),a):
            fib.append(fib[i-1]+fib[i-2])
    ans+=fib[a-1]
    if ans >= 1000000007:
        ans-=1000000007
    bef=a+1

print(max(1,ans))
