<?php
fscanf(STDIN, "%d %d", $n, $m);
$a_b = -1; $s = 1;
$fact_l = []; $pattern_l = [];
for ($i=0; $i < $m + 1; $i++) {
  if ($i === $m) {
    $a = $n + 1;
  } else {
    fscanf(STDIN, "%d", $a);
  }
  $sp = $a - $a_b - 1;
  if ($sp === 0) {
    $s = 0;
    break;
  }
  $s *= $sp >= 3 ? get_pattern($sp) : 1;
  $a_b = $a;
}
echo $s % 1000000007;

function get_pattern($n) {
  global $pattern_l;
  if (!isset($pattern_l[$n])) {
    $st2_m = floor(($n - 1) / 2);
    $pattern_l[$n] = 0;
    for ($st2=0; $st2 < $st2_m + 1; $st2++) {
      $st1 = $n - ($st2 * 2 + 1);
      if ($st2 === 0 or $st1 === 0) {
        $pattern_l[$n] += 1;
      } else {
        $pattern_l[$n] += get_m_fact($st1 + $st2, $st1, $st2);
      }
    }
  }
  return $pattern_l[$n];
}

function get_m_fact($x, $y, $z) {
  return get_fact($x) / get_fact($y) / get_fact($z);
}

function get_fact($d) {
  global $fact_l;
  if (!isset($fact_l[$d])) {
    $fact_l[$d] = $d > 0 ? $d * get_fact($d - 1) : 1;
  }
  return $fact_l[$d];
}
?>