class MyLib
  def combi(x,y)
    y=x-y if 2*y > x
    return 1 if y == 0
    ((x-y+1)..x).reduce(&:*)/((1..y).reduce(&:*))
  end
end

n, m = gets.split.map(&:to_i)
aa =
  readlines.map do |i|
    i.chomp.to_i
  end.to_a

cnt = 1
st = 0
aa.each do |a|
  en = a - 1
  if st > en
    # できない
    cnt = 0
    break
  end
  #st-enの組み合わせ数
  cnt_combi = 0

  step = en - st
  jump = step / 2
  0.upto(jump) do |i|
    # jumpとstepの合計の中からjumpを取る組み合わせ
    cnt_combi += MyLib.new.combi(step-2*i+i, i)
    #puts cnt_combi
  end
  cnt = cnt * cnt_combi % 1_000_000_007

  st = a + 1
end

# aa最後よりあと
if st>n
  puts cnt % 1_000_000_007
  exit
end

en = n
#st-enの組み合わせ数
cnt_combi = 0
step = en - st
jump = step / 2
0.upto(jump) do |i|
  # jumpとstepの合計の中からjumpを取る組み合わせ
  cnt_combi += MyLib.new.combi(step-2*i+i, i)
end
cnt = cnt * cnt_combi % 1_000_000_007

puts cnt % 1_000_000_007