def noboru(i, a2, a1):
    if (i == 1):
        return a1
    elif (i == 2):
        return a2
    else:
        return noboru(i-1, a2+a1, a2)


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

N, M = map(int, input().split(" "))
a = [int(input()) for _ in range(M)]
print(func(N, M, a) % 1000000007)