#import sys
#input = sys.stdin.buffer.readline

def main():
    #print(arg)
    #input = arg.split("\n")
    N,M = list(map(int, input().split(" ")))
    #print(input)
    #return
    A = [int(input()) for i in range(M)]
    #print(N)
    #print(M)
    print(A)

    #return

    if len(A) > 1:
        for i in range(1,M):
            if A[i] - A[i-1] == 1:
                print(0)
                return


    dp = [0] * (N-M+1)
    dp[0] = 1

    for i in range(1,N-M+1):
        dp1 = dp[i-1]%1000000007
        dp2 = 0
        if i >= 2:
            dp2 = (dp[i-2]*2)%1000000007
        
        print("i={0}: dp1={1}, dp2={2}".format(i, dp1, dp2))
        dp[i] = max(dp1, dp2)
        
    print(dp[N-M])

#main("6 1\n3")
main()