<?php
  fscanf(STDIN, "%d %d", $n, $m);
  while ( ! feof(STDIN) ) {
  $breakSt[] = trim(fgets(STDIN));
  }
  $ans = 0;
  $max = 0;
  $min = 0;
  $sum = 0;
  $none = 1;
  for($i=0;$i<count($breakSt);$i++){
    if($breakSt[$i]+1 == $breakSt[$i+1]){
      $none = 1;
    }
  }
  for($i = 1;$i <= $n; $i++){
    foreach($breakSt as $value){
      if($i == $value){
        $i++;
      }
    }
    $max += $i;
  }
  for($i = 0;$i <= $n; $i+=2){
      foreach($breakSt as $value){
        if($i == $value){
          $i--;
        }
      }
    $min += $i;
  }
  while($sum != $min && !$none){
    $sum = 0;
    for($i = 1;$i < $n; $i++){
      if($sum == $max){
        $i--;
        $sum--;
        foreach($breakSt as $value){
          if($i == $value){
            $i--; //$iをスキップして一段戻る
            $sum--;
          }
        }
        $max = $sum;
      }else{
        foreach($breakSt as $value){
          if($i == $value){
            $i++; //$iをスキップ
          }
        }
      }
      if($sum == $min){
        break;
      }
      $sum += $i;
      $ans++;
    }
  }
  echo $ans % 10000000007;
  ?>