<?php
fscanf(STDIN, "%d %d", $n, $m);
$a_b = -1; $s = 0;
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 ? floor(($sp - 1) / 2) : 0;
  $a_b = $a;
}
if ($s == 0) {
  $r = 0;
} else {
  $r = 1;
  for ($i=0; $i < $s; $i++) {
    $r = 2 * $r % 1000000007;
  }
}
echo $r;
?>
