import math
n, m = map(int, input().split())
p = []
pre = 0

def pattern_count(a,b):
    if a == 0 or b == 0:
        return 1
    else:
        return math.factorial(a+b)//(math.factorial(a)*math.factorial(b))

def count(a):
    ret = 0
    for i in range(a//2 + 1):
        ret += pattern_count(i, a-i*2)
    if ret == 0:
        return 1
    else:
        return ret

fault = False
for _ in range(m):
    a = int(input())
    if a == pre:
        fault = True
        break
    print(a-pre-1)
    p.append(count(a-pre-1))
    pre = a+1

if fault:
    print(0)
else:
    p.append(count(n-pre))

    ans = 1
    for a in p:
        ans *= a

    print(p)
    print(ans % 1000000007)