def noboru(m):
    if (m == 1):
        return 1
    elif (m == 2):
        return 2
    else:
        return noboru(m-1)+noboru(m-2)

def func(N, M, a):
    ans = 1
    i = 0
    if (a[0] == 1):
        ans *=1
    else:
        ans *= noboru(a[0]-1)
    if (M > 1):
        for i in range(1, M):
            if (a[i] == a[i-1]+1):
                return 0
            else:
                ans *= noboru(a[i] - 2 - a[i-1])
    ans *= noboru(N - 1 - a[i])
    return ans % 1000000007

N, M = map(int, input().split(" "))
a = [int(input()) for _ in range(M)]
#A_i = list(map(int, input().split(" ")))
#B_i = list(map(int, input().split(" ")))
print(func(N, M, a))
#print(noboru(6))