def calc_pattern(stair_num, damaged_step_list, state_number):
    if stair_num == 1:
        return 1
    if stair_num == 3 and damaged_step_list==[1]:
        return 1
    
    
if __name__ == '__main__':
    N, M = map(int, input().split())
    a = [int(input()) for _ in range(M)]
    a = sorted(a)

    answer = 1
    if a[-1::] == N:
        answer = 0

    for i in range(1, M):
        if a[i-1] + 1 == a[i]:
            answer = 0

    if answer != 0:
        for i in range(1, N+1):
            if i+1 in a:
                continue
            else:
                answer = (answer * 2)%1000000007
            print(str(i) + ' ' + str(answer))
    print(answer)