$m = [1,1]
def fib(n)
   $m[n] ||= fib(n-1) + $m[-2]
end

N,M = gets.split.map(&:to_i)
A = readlines.map(&:to_i)
MOD = 1000000007
if A.each_cons(2).all? {|a,b| b - a > 1 }
  puts [0, A.map {|n| [n-1, n+1] }, N].flatten
	.each_slice(2).map {|n,m| (n...m).size }
	.map {|n| fib(n) }.inject(:*) % MOD
else
  puts 0
end