<?php

function fibonacci($n) {
  $f0 = $f1 = 1;
  for ($i = 2; $i <= $n; $i++) {
    $tmp = $f1;
    $f1 = $f0 + $f1;
    $f0 = $tmp;
  }

  return $f1;
}

$stdin = fscanf(STDIN, "%d %d\n");
for ($i = 0; $i < $stdin[1]; $i++) {
  $array[] = trim(fgets(STDIN)) * 1;
  if ($i != 0 && $array[$i] - $array[$i - 1] == 1) {
    print(0);
    return;
  }
}
$array[] = $stdin[0] + 1;
for ($i = 0; $i < count($array); $i++) {
  if ($i == 0) {
    $f = $array[$i] - 1;
    $sum = fibonacci($f);
    continue;
  }

  $f = $array[$i] - $array[$i - 1] - 2;
  $sum *= fibonacci($f);
  $sum %= 1000000007;
}

print($sum);
