#include<bits/stdc++.h>
#define XX first
#define YY second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define REP rep
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
const ll MOD=1e9+7;

#define rall(X) (X).rbegin(),(X).rend()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}

template<ll mod>
struct ModInt{
  using M=ModInt;
  ll a;
  M& put(ll v){
    a=(v<mod)?v:v-mod;
    return *this;
  }
  ModInt(ll v=0){put(v%mod+mod);}
  M operator+(M x){return M().put(a+x.a);}
  M operator-(M x){return M().put(a+mod-x.a);}
  M operator*(M x){return M().put(a*x.a%mod);}
  M operator/(M x){return x.inv()*a;}
  M& operator+=(M x){return *this=*this+x;};
  M& operator-=(M x){return *this=*this-x;};
  M& operator*=(M x){return *this=*this*x;};
  M& operator/=(M x){return *this=*this/x;};
  bool operator==(M x){return a==x.a;}
  M pow(ll m) {
    M x=*this,res=1;
    while(m){
      if(m&1)res*=x;
      x*=x;
      m>>=1;
    }
    return res;
  }
  M inv(){return pow(mod-2);}
};
using mint = ModInt<MOD>;

using Vec = vector<mint>;
struct Matrix : vector<Vec> {
  int H, W;
  Matrix(int h, int w) : vector<Vec>(h, Vec(w)) {
    H = size(); W = (*this)[0].size(); 
  }
  template<class... A>
  Matrix(A... a) : vector<Vec>(a...) {
    H = size(); W = (*this)[0].size(); 
  }
  Matrix(initializer_list<Vec> a) : vector<Vec>(a) {
    H = size(); W = (*this)[0].size(); 
  }
     
  Matrix operator+(Matrix &B) {
    assert(H == B.H);
    assert(W == B.W);
    Matrix C = *this;
    rep(i, H) rep(j, W) C[i][j] += B[i][j];
    return C;
  }
  Matrix operator-(Matrix &B) {
    assert(H == B.H);
    assert(W == B.W);
    Matrix C = *this;
    rep(i, H) rep(j, W) C[i][j] += B[i][j];
    return C;
  }
  Matrix operator*(Matrix &B) {
    assert(W == B.H);
    Matrix C(H, B.W);
    rep(i, H) rep(k, W) rep(j, B.W) C[i][j] += (*this)[i][k]*B[k][j];
    return C;
  }
  Matrix& operator+=(Matrix &x){return *this=*this+x;};
  Matrix& operator-=(Matrix &x){return *this=*this-x;};
  Matrix& operator*=(Matrix &x){return *this=*this*x;};
};

int N, M;
vector<int> X;

Matrix M1 = {
  {0, 1, 0},
  {0, 0, 1},
  {1, -2, 4}
};

Vec GetVal(LL k, Vec u) {
  Matrix v(3, 1);
  rep(i, 3) v[i][0] = u[i];

  Matrix m = M1;
  int r = m.size();
  Matrix res(r, r);
  rep(i, r) res[i][i] = 1;
  while (k > 0) {
    if (k%2) res *= m;
    m *= m;
    k >>= 1;
  }
  Vec ret(3);
  res *= v;
  assert(res.H == 3 && res.W == 1);
  rep(i, 3) ret[i] = res[i][0];
  return ret;
}

map<int, mint> A;
map<int, mint> D;
map<int, mint> S;
map<int, mint> K;

void Clear(int k) {
  A.erase(k);
  S.erase(k);
  K.erase(k);
}

set<int> banned;
void CalcNaive(int k) { // k-1 should satisfy the equation
  if (k == 1) {
    A[1] = 1;
    S[1] = 2;
    K[1] = 1;
    return;
  }
  assert(!banned.count(k-1));
  assert(S.count(k-2));
  assert(K.count(k-2));
  assert(S.count(k-1));
  assert(K.count(k-1));
  A[k] = A[k-1]*2 + S[k-2]*(2*k-1) - K[k-2]*2;
  S[k] = S[k-1] + A[k];
  K[k] = K[k-1] + A[k] * k;
}

signed main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);

  cin >> N >> M;

  vector<int> xs;
  rep(i, M) {
    int x;
    cin >> x;
    banned.insert(x);
    if (x > 1) xs.eb(x-1);
    xs.eb(x);
    xs.eb(x+1);
  }
  xs.eb(N);
  sort(all(xs));
  xs.erase(unique(all(xs)), xs.end());

  A[0] = 1;
  S[0] = 1;
  K[0] = 0;
  LL prev = 0;
  for (int n : xs) {
    if (banned.count(n)) {
      S[n] = S[prev];
      K[n] = K[prev];
      continue;
    }
    if (banned.count(n-1)) { // black
      mint d = n - prev;
      if (prev == 0) {
        A[n] = d*d;
        S[n] = A[n]+1;
        K[n] = A[n]*n;
      } else {
        assert(prev > 0);
        assert(S.count(prev-1));
        assert(K.count(prev-1));
        A[n] = A[prev]*(d*d+1) + S[prev-1]*(d*2*prev+d*d) - K[prev-1]*d*2;
        S[n] = S[prev]+A[n];
        K[n] = K[prev]+A[n]*n;
      }
    } else { // white 
      LL d = n - prev;
      if (d <= 6) {
        reps(i, prev+1, n+1) {
          assert(!banned.count(i));
          CalcNaive(i);
        }
      } else {
        int pn = n-1;
        reps(i, prev+1, prev+4) {
          assert(!banned.count(i));
          CalcNaive(i);
        }
        auto u = Vec{A[prev+1], A[prev+2], A[prev+3]};
        auto v = GetVal(pn+2-(prev+3), u);
        A[pn+3] = GetVal(1, v)[2];
        rep(j, 3) A[pn+j] = v[j];
        S[pn] = (A[pn+3] - A[pn+2]*3 - A[pn+1]) / 2;
        K[pn] = (S[pn]*(mint(2)*pn+3) - A[pn+2] + A[pn+1]*2) / 2;
        reps(j, n+1, pn+4) Clear(j);
        S[n] = S[pn] + A[n];
        K[n] = K[pn] + A[n]*n;
      }
    }
    prev = n;
  }
  // map<int, mint> t, tt;
  // mint tot = 0, tot2 = 0;
  // for (auto &itr : A) {
  //   cout << itr.XX << ": " << itr.YY.a << endl;
  //   tot += itr.YY;
  //   tot2 += itr.YY * itr.XX;
  //   t[itr.XX] = tot;
  //   tt[itr.XX] = tot2;
  // }
  // for (auto &itr : S) {
  //   cout << itr.XX << ": " << itr.YY.a << " - " << t[itr.XX].a << endl;
  // }
  // for (auto &itr : K) {
  //   cout << itr.XX << ": " << itr.YY.a << " - " << tt[itr.XX].a << endl;
  // }
  cout << A[N].a << endl;
}


Measured memory_bytes: 131056