def fib(n):

    a, b = 0, 1

    if n == 1:

        return a

    elif n == 2:

        return b

    else:

        for i in range(n-2):

            a, b = b, a + b

        return b

    

N, M = list(map(int, input().split()))

a = [-1]

for i in range(M):

    a.append(int(eval(input())))

    

for i in range(M-1):

    if a[i+1] == (a[i] + 1):

        print((0))

        exit()

    

combi = 1



for i in range(len(a)-1):

    dis = a[i+1] - a[i]

    #print(dis)

    combi *= fib(dis)

    #print(a[i])

    

dis = N+1 - a[-1]

#print(dis)

combi *= fib(dis)



print((combi % 1000000007))
N, M = list(map(int, input().split()))



# 壊れている床

a = [-1]

for i in range(M):

  a.append(int(eval(input())))

  # 連続して壊れていたら辿り着けない

  if a[i + 1] - a[i] == 1:

    print((0))

    exit()



# フィボナッチ数列

def fib(n):

  a, b = 0, 1

  if n == 1:

    return a

  elif n == 2:

    return b

  else:

    for i in range(n-2):

      a, b = b, a + b

    return b



# 階段を登る組み合わせ

combi = 1



for i in range(len(a) - 1):

  # 次の穴との距離

  dis = a[i+1] - a[i]

  #print(dis)

  combi *= fib(dis)

  #print(a[i])

    

dis = N+1 - a[-1]

#print(dis)

combi *= fib(dis)

 

print((combi % 1000000007))
def fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n - 2):
            a, b = b, a + b
        return b


N, M = list(map(int, input().split()))
a = [-1]
for i in range(M):
    a.append(int(eval(input())))
for i in range(M - 1):
    if a[i + 1] == (a[i] + 1):
        print((0))
        exit()
combi = 1
for i in range(len(a) - 1):
    dis = a[i + 1] - a[i]
    # print(dis)
    combi *= fib(dis)
    # print(a[i])
dis = N + 1 - a[-1]
# print(dis)
combi *= fib(dis)
print((combi % 1000000007))

N, M = list(map(int, input().split()))
# 壊れている床
a = [-1]
for i in range(M):
    a.append(int(eval(input())))
    # 連続して壊れていたら辿り着けない
    if a[i + 1] - a[i] == 1:
        print((0))
        exit()
# フィボナッチ数列
def fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n - 2):
            a, b = b, a + b
        return b


# 階段を登る組み合わせ
combi = 1
for i in range(len(a) - 1):
    # 次の穴との距離
    dis = a[i + 1] - a[i]
    # print(dis)
    combi *= fib(dis)
    # print(a[i])
dis = N + 1 - a[-1]
# print(dis)
combi *= fib(dis)
print((combi % 1000000007))

+N, M = list(map(int, input().split())) +# 壊れている床 +a = [-1] +for i in range(M): +    a.append(int(eval(input()))) +    # 連続して壊れていたら辿り着けない +    if a[i + 1] - a[i] == 1: +        print((0)) +        exit() +# フィボナッチ数列 -N, M = list(map(int, input().split())) -a = [-1] -for i in range(M): -    a.append(int(eval(input()))) -for i in range(M - 1): -    if a[i + 1] == (a[i] + 1): -        print((0)) -        exit() +# 階段を登る組み合わせ +    # 次の穴との距離