import math
phi = (1 + math.sqrt(5)) / 2

def counter(n):
    if n == 1:
        return 0
    else:
        f = round(phi**(n) / math.sqrt(5)) % (10**9+7)
        return f

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
ans = round(phi**(a[0]) / math.sqrt(5)) % (10**9+7)
print(ans)
for i in range(1,M):
    ans = (ans * counter(a[i]-a[i-1]-1)) % (10**9+7)

ans = ans * round(phi**(N-a[-1]) / math.sqrt(5)) % (10**9+7)

print(ans)