#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

template<typename T>
struct SegmentTree{
private:
    int n;
    T E;
    vector<T> node;
    inline void updatef(T& x,T& y){
        x = y;
        //x += y;
        //x = max(x,y);
        //x = min(x,y);
    }
    inline T queryf(T& x,T& y){
        return x*y;
        //return x+y;
        //return max(x,y);
        //return min(x,y);
    }

public:
    SegmentTree(int sz,T& E_):E(E_){
        n=1;
        while(n<sz)n<<=1;
        node.resize(2*n-1,E);
    }

    SegmentTree(vector<T>& A,T& E_):E(E_){
        int sz=A.size();
        n=1;
        while(n<sz)n<<=1;
        node.resize(2*n-1,E);
        rep(i,sz)node[i+n-1]=A[i];
        for(int i=n-2;i>=0;--i){
            node[i]=queryf(node[2*i+1], node[2*i+2]);
        }
    }
    void update(int k,T x){
        k+=n-1;
        updatef(node[k],x);
        while(k>0){
            k=(k-1)/2;
            node[k]=queryf(node[2*k+1], node[2*k+2]);
        }
    }
       //[a,b)での和を返す
    T get(int a,int b,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        if(r<=a||b<=l)return E;
        if(a<=l&&r<=b)return node[k];
        T xl=get(a,b,2*k+1,l,(l+r)/2);
        T xr=get(a,b,2*k+2,(l+r)/2,r);
        return queryf(xl, xr);
    }
};

template<typename T>
struct Matrix{
    int h,w;
    vector<T> a;
    Matrix(int n_=0):h(n_),w(n_),a(n_*n_){}
    Matrix(int n_, int m_):h(n_),w(m_),a(n_*m_){}
    Matrix(int n_, int m_, vector<T> a_):h(n_),w(m_),a(a_){}
    T& get(int r,int c){return a[r*w+c];}
    T get(int r,int c)const{return a[r*w+c];}

    Matrix& operator+=(const Matrix& m) {
		assert(h == m.h && w == m.w);
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				a[i * w + j] += m.a[i * w + j];
			}
		}
	}
	Matrix& operator-=(const Matrix& m) {
		assert(h == m.h && w == m.w);
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				a[i * w + j] -= m.a[i * w + j];
			}
		}
	}
	Matrix& operator*=(const Matrix& m) {
		assert(w == m.h);
		Matrix ans(h, m.w);
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < m.w; ++j) {
				for (int k = 0; k < w; ++k) {
					(ans.a[i * m.w + j] += a[i * w + k] * m.a[k * m.w + j])%=mod;
				}
			}
		}
		return (*this) = ans;
	}
	Matrix operator+(const Matrix& m) const { return Matrix(*this) += m; }
	Matrix operator-(const Matrix& m) const { return Matrix(*this) -= m; }
	Matrix operator*(const Matrix& m) const { return Matrix(*this) *= m; }
};
template<typename T>
Matrix<T> unit(int n){
    Matrix<T> ret(n);
    rep(i,n)ret.get(i,i)=1;
    return ret;
}
template<typename T>
Matrix<T> matpow(Matrix<T> a,int n){
    assert(a.h==a.w);
    Matrix<T> ret=unit<T>(a.h);
    while(n){
        if(n&1)ret*=a;
        a*=a;
        n>>=1;
    }
    return ret;
}


using mat=Matrix<ll>;

const mat A(3,3,{4,mod-2,1,1,0,0,0,1,0});
ll calc(int n){
    mat B = matpow(A,n);
    return (5*B.get(2,0)+B.get(2,1))%mod;
}

vector<ll> cal(mat A,vector<ll> x){
    vector<ll> ret(3);
    rep(i,3)rep(j,3)(ret[i]+=A.get(i,j)*x[j])%=mod;
    return ret;
}

vector<ll> ad(vector<ll> x,vector<ll> y){
    vector<ll> ret(3);
    rep(i,3)ret[i]=(x[i]+y[i])%mod;
    return ret;
}


int main(){
    int n,m;
    cin>>n>>m;
    vector<ll> vec[m+2];
    ll dp[m+2];
    dp[0]=0;
    ll a[m+2];
    rep(i,m)cin>>a[i+1];
    a[0]=0;
    a[m+1]=n;
    vec[0]={0,0,0};
    rep(i,m+1){
        vec[i]=cal(matpow(A,a[i+1]-a[i]),vec[i]);
        dp[i+1]=(mod+calc(a[i+1])-vec[i][2]%mod)%mod;
        vec[i+1]={5*dp[i+1]%mod,dp[i+1],0};
        vec[i+1]=ad(vec[i+1],vec[i]);
    }
    cout<<dp[m+1]<<endl;
}



Measured memory_bytes: 7296