<?php
fscanf(STDIN, "%d %d", $n, $m);
$a_b = -1; $s = 1;
$pow_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])) {
    $pattern_l[$n] = pow_2(floor(($n - 1) / 2));
  }
  return $pattern_l[$n];
}

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