import numpy as np
N,M = map(int,input().split())
ans = []
a = [int(input()) for i in range(M)]
a.append(N)
a.append(0)
a.sort()
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
for j in range(1,M+2):
  if a[j] - a[j-1] == 1:
    continue
  else:
    m = a[j] - a[j-1] - 1 
    ans.append(fib(m+1))
print(ans)
print(np.prod(ans) % 1000000007)