def func(i):
  global num
  if min([abs(j-i) for j in a]) == 0:
    return 0
  if i == n:
    num += 1
    return 0
  elif i == n+1:
    return 0
  func(i+1)
  func(i+2)

n, m = map(int, input().split())
a = [0 for i in range(m)]
for i in range(m):
  a[i] = int(input())
print(n, m)
print(a)
num = 0
func(0)
num = num % 1000000007
print(num)