#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;
const int MOD=1000000007;
typedef struct S { int f,g,F,FS; } S;
typedef int Mat[4][4];

int len,n;
int x[MAXN];
int sf[3]; bool shave[3];

void mmult(Mat &A,const Mat &B) {
	static Mat C; REP(i,4) REP(j,4) { ll c=0; REP(k,4) c+=(ll)A[i][k]*B[k][j]; C[i][j]=c%MOD; } REP(i,4) REP(j,4) A[i][j]=C[i][j];
}
void mpow(const Mat &A,int n,Mat &B) {
	static Mat X; REP(i,4) REP(j,4) X[i][j]=A[i][j];
	REP(i,4) REP(j,4) B[i][j]=i==j?1:0; 
	while(true) { if(n&1) mmult(B,X); if((n>>=1)==0) break; mmult(X,X); }
}
S smult(const Mat &A,S x) {
	S ret;
	ret.f=((ll)A[0][0]*x.f+(ll)A[0][1]*x.g+(ll)A[0][2]*x.F+(ll)A[0][3]*x.FS)%MOD;
	ret.g=((ll)A[1][0]*x.f+(ll)A[1][1]*x.g+(ll)A[1][2]*x.F+(ll)A[1][3]*x.FS)%MOD;
	ret.F=((ll)A[2][0]*x.f+(ll)A[2][1]*x.g+(ll)A[2][2]*x.F+(ll)A[2][3]*x.FS)%MOD;
	ret.FS=((ll)A[3][0]*x.f+(ll)A[3][1]*x.g+(ll)A[3][2]*x.F+(ll)A[3][3]*x.FS)%MOD;
	return ret;
}
Mat A,B;

int solve() {
	if(len==1) return 1;
	memset(A,0,sizeof(A)); A[0][0]=1,A[0][1]=1,A[0][2]=1,A[0][3]=2; A[1][1]=1,A[1][2]=1,A[1][3]=2; A[2][0]=1,A[2][1]=1,A[2][2]=1,A[2][3]=2; A[3][2]=1,A[3][3]=1;
	REP(i,3) shave[i]=false; REP(i,n) if(x[i]>=len-2) shave[len-x[i]]=true;
	sf[0]=1; FORE(i,1,2) { sf[i]=0; FORE(j,1,i) if(!shave[i-j]) sf[i]=sf[i]+j*j*sf[i-j]; }
	S cur; cur.f=sf[2]; cur.g=sf[2]-sf[1]; cur.F=shave[2]?0:sf[2]; cur.FS=(shave[1]?0:sf[1])+(shave[0]?0:sf[0]); int i=len-2,at=n-1;
	//printf("i=%d f=%d g=%d F=%d FS=%d\n",i,cur.f,cur.g,cur.F,cur.FS);
	for(;i>0;) {
		while(at>=0&&x[at]>=i) --at; //bool have=at>=0&&x[at]==i-1;
		assert(i-1<=len-3);
		int ni=at>=0?x[at]:0;
		mpow(A,i-ni,B);
		S nxt=cur; cur=smult(B,nxt); if(at>=0&&x[at]==ni) cur.F=0; i=ni;
		//printf("i=%d f=%d g=%d F=%d FS=%d\n",i,cur.f,cur.g,cur.F,cur.FS);
	}
	return cur.f;
}

void run() {
	scanf("%d%d",&len,&n);
	REP(i,n) scanf("%d",&x[i]);

	/*vector<int> f(len+1,0),g(len+1,0),h(len+1),fs(len+2); f[len]=1,g[len]=0,h[len]=0,fs[len+1]=0;
	vector<bool> have(len+1,false); REP(i,n) have[x[i]]=true;
	for(int i=len-1;i>=0;--i) {
		FORE(j,1,len-i) {
			if(have[i+j]) continue;
			f[i]=(f[i]+(ll)f[i+j]*j%MOD*j)%MOD;
		}
		g[i]=(f[i]+MOD-f[i+1])%MOD;
		h[i]=(g[i]-g[i+1]+MOD)%MOD;
		fs[i+1]=(fs[i+2]+f[i+1])%MOD;
		if(i<=len-2) {
			int act=(f[i]+MOD-f[i+1])%MOD;
			int exp=0; if(!have[i+1]) exp+=f[i+1]; FORE(j,2,len-i) if(!have[i+j]) exp=(exp+(ll)f[i+j]*(2*j-1))%MOD;
			if(act!=exp) printf("g%d: act=%d exp=%d\n",i,act,exp);
		}
		if(i<=len-3) {
			int act=((f[i]+MOD-f[i+1])%MOD+MOD-(f[i+1]+MOD-f[i+2])%MOD)%MOD;
			int exp=0; if(!have[i+1]) exp+=f[i+1]; FORE(j,2,len-i) if(!have[i+j]) exp=(exp+(ll)2*f[i+j])%MOD;
			if(act!=exp) printf("h%d: act=%d exp=%d\n",i,act,exp);
		}

		//printf("%d: f=%d g=%d h=%d fs=%d (%d)\n",i,f[i],g[i],h[i],fs[i+1],((ll)f[i+1]+2*fs[i+2])%MOD);
	}
	printf("%d\n",f[0]);*/
	int ret=solve();
	printf("%d\n",ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 640