n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [-1 for _ in range(n)]

def checker(s, g):
    if s > g:
        return 0
    elif s == g:
        return 1
    else:
        if dp[g - s] != -1:
            return dp[g - s]
        else:
            ret = checker(s + 1, g) + checker(s + 2, g)
            dp[g - s] = ret
            return ret

s = 0
g = a[0] - 1
if g - s > 0:
    c = checker(s, g)
else:
    c = 1
for i in range(1, m):
    if a[i - 1] + 1 == a[i]:
        c = 0
        break
    else:
        s = a[i - 1] + 1
        g = a[i] - 1
        if g - s > 0:
            c *= checker(s, g)
        s = a[m - 1] + 1
        g = n
if g - s > 0:
    c *= checker(s, g)

print(c % 1000000007)
