n, m = gets.chomp.split(" ").map(&:to_i)
a = [0]
1.upto(m) do |i|
  a[i] = gets.chomp.to_i
end

def combi2(n, k)
  $memo ||= {}
  key = "#{n},#{k}"
  return $memo[key] if $memo[key]
  num1 = 1
  num2 = 1
  1.upto(k) do |i|
    num1 *= (n - i + 1)
    num2 *= i
  end
  num = num1 / num2
  $memo[key] = num
  num
end

def n_pattern2(d)
  return 1 if d.zero?
  c = 0
  cc = nil
  0.upto(d / 2) do |i|
    n2 = i
    n1 = d - 2 * i
    nn = n1 + n2
    if n1.zero? || n2.zero?
      c += 1
    else
      if cc
        cl = nn
        cr = n2
        cc = cc * ((cl - cr + 1)..(cl - cr + 2)).inject(1, :*) / ((cl + 1) * cr)
        c += cc
      else
        cc = combi2(nn, n2)
        c += cc
      end
    end
  end
  c
end

c = 1
cur = 0
1.upto(m) do |i|
  if a[i] == cur
    puts 0
    exit
  end
  d = a[i] - cur - 1
  c *= n_pattern2(d)
  cur += d + 2
end
d = n - cur
c *= n_pattern2(d)
puts c % 1_000_000_007
