#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX((X), (Y)) ( ((X) > (Y))? (X) : (Y))
#define MIN((X), (Y)) (((X) < (Y))? (X) : (Y))
//　min
int main(void){
  int n, m;
  int a[100000];
  int MOD = 1000000007;
  int sum = 0
  
  scanf("%d%d", &n, &m);

  for(int i = 1; i <= m; i++){
    scanf("%d", &a[i])
    if(a[i] == a[i-1]){
      printf("0\n");
      return 0; 
    }
  }

//  int cntm = 0;
//  a[0] = 0;
//  a[1] = 1;
  for(int i = 2; i <= n; i++){
    if(a[m] == i){ 
   //   a[i] = a[i-1] +
      sum = sum + 1;
    }else{
      sum = sum + 2;
    }    

    if(sum > MOD){
      sum -= MOD;
     }
  }
  
  printf("%d\n", sum);

  return 0;
}
