#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    a_list = [int(input()) for _ in range(M)]

    def comb(N):
        if N<0:
            return 0
        if N==0:
            return 1
        import numpy as np
        dp=np.zeros((3, N+1), dtype=np.int64)
        for j in range(1,N+1):
            dp[0][j] = 1
            for i in [1,2]:
                if j == i:
                    dp[i][j] = dp[i-1][j]
                else:
                    dp[i][j] = dp[1][j-i] + dp[2][j-i]
        return dp[1][N]+dp[2][N]
    p = 0
    divider = 1000000007
    ans = 1
    for a in a_list:
        r = comb(a-1-p)%divider
        ans = ans * r
        p = a + 1
    else:
        if a < N:
            r = comb(N-p)%divider
            ans = ans * r
    ans = ans%divider
    print(ans)
        

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","c",main)