#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int power(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}


struct M {
  const static int n = 3;
  int a[n][n];

  M(int diag = 0) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        a[i][j] = 0;
      }
    }
  }

  M operator * (const M &m) const {
    M res;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        long long cur = 0;
        for (int k = 0; k < n; ++k) {
          cur += (long long) a[i][k] * m.a[k][j];
          if (cur >= (long long) 8e18) {
            cur %= mod;
          }
        }
        res.a[i][j] = cur % mod;
      }
    }
    return res;
  }

  M operator ^ (long long pw) const {
    M res(1);
    M x = *this;
    for (; pw; pw >>= 1) {
      if (pw & 1) {
        res = res * x;
      }
      x = x * x;
    }
    return res;
  }
};


const int k = M::n;

const int maxn = 100;
int a[maxn][maxn + 1];
int cs[maxn];

const int maxv = maxn * 2;
int f[maxv];

M A;

const int maxl = 30;
M As[maxl];

void precalc() {
  f[0] = 1;
  for (int i = 1; i < maxv; ++i) {
    auto &cur = f[i];
    cur = 0;
    for (int j = 0; j < i; ++j) {
      add(cur, mult(mult(i - j, i - j), f[j]));
    }
    //eprintf("%d%c", cur, " \n"[i == maxv - 1]);
  }

  int n = k;
  assert(n <= maxn);
  //eprintf("n = %d\n", n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < k; ++j) {
      a[i][j] = f[i + j + 1];
    }
    a[i][k] = f[i + k + 1];
    assert(i + k + 1 < maxv);
  }


  for (int c = 0; c < n; ++c) {
    //eprintf("%d/%d\n", c, k);
    int r = -1;
    for (int i = c; i < n; ++i) {
      if (a[i][c]) {
        r = i;
        break;
      }
    }
    assert(r != -1);
    assert(a[r][c]);

    swap(a[r], a[c]);
    r = c;

    {
      int x = power(a[r][c], mod - 2);
      for (int i = 0; i <= n; ++i) {
        a[r][i] = mult(a[r][i], x);
      }
    }

    for (int i = 0; i < n; ++i) {
      if (i == r) {
        continue;
      }
      int x = a[i][c];
      for (int j = 0; j <= n; ++j) {
        add(a[i][j], mod - mult(x, a[r][j]));
      }
    }
  }

  for (int i = 0; i < n; ++i) {
    cs[i] = mult(a[i][n], power(a[i][i], mod - 2));
    eprintf("%d%c", cs[i], " \n"[i == n - 1]);
  }

  for (int i = k + 1; i < maxv; ++i) {
    int res = 0;
    for (int j = 0; j < k; ++j) {
      int v = i - k + j;
      add(res, mult(cs[j], f[v]));
    }
    //eprintf("i = %d, res = %d, fi = %d\n", i, res, f[i]);
    assert(res == f[i]);
  }

  A = M();
  for (int i = 0; i < A.n - 1; ++i) {
    A.a[i][i + 1] = 1;
  }
  for (int i = 0; i < A.n; ++i) {
    A.a[A.n - 1][i] = cs[i];
  }
  As[0] = A;
  for (int i = 1; i < maxl; ++i) {
    As[i] = As[i - 1] * As[i - 1];
  }
}

int n, m;

const int maxm = (int) 1e5 + 10;
int xs[maxm];

int read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return 0;
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", &xs[i]);
  }
  return 1;
}

int vec[M::n];
int nvec[M::n];

void solve() {
  --f[0];
  for (int i = 0; i < M::n; ++i) {
    vec[i] = f[i];
  }
  /*
  for (int i = 0; i < M::n; ++i) {
    eprintf("%d%c", vec[i], " \n"[i == M::n - 1]);
  }
  */

  for (int i = 0; i <= m; ++i) {
    int pw = (i == m ? n : xs[i]) - (i ? xs[i - 1] : 0);
    for (int it = 0; it < maxl; ++it) {
      if (pw & (1 << it)) {
        for (int j = 0; j < M::n; ++j) {
          auto &cur = nvec[j];
          cur = 0;
          for (int k = 0; k < M::n; ++k) {
            add(cur, mult(As[it].a[j][k], vec[k]));
          }
        }
        swap(vec, nvec);
      }
    }
    /*for (int i = 0; i < M::n; ++i) {
      eprintf("%d%c", vec[i], " \n"[i == M::n - 1]);
    }*/

    if (i < m) {
      for (int i = M::n - 1; i >= 0; --i) {
        add(vec[i], mod - mult(vec[0], f[i]));
      }
    }
  }

  int res = vec[0];
  printf("%d\n", res);
  ++f[0];
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 640