// Copyright (C) 2017 __debug.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
using std::pair;
using std::vector;
using std::string;
typedef long long LL;
typedef pair<int, int> Pii;
const int oo = 0x3f3f3f3f;
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
std::ifstream t("/proc/self/status");
return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
int f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
f = (ch == '-' ? -1 : 1);
for (x = 0; isdigit(ch); ch = getchar())
x = 10 * x + ch - '0';
return x *= f;
}
template<typename T> void write(T x)
{
if (x == 0) {
putchar('0');
return;
}
if (x < 0) {
putchar('-');
x = -x;
}
static char s[20];
int top = 0;
for (; x; x /= 10)
s[++top] = x % 10 + '0';
while (top)
putchar(s[top--]);
}
// EOT
const int MAXM = 1e5 + 5;
const int MOD = 1e9 + 7;
struct Matrix {
static const int SIZE = 3;
int n, m;
int a[SIZE][SIZE];
Matrix() { }
Matrix(int n_, int m_): n(n_), m(m_)
{
memset(a, 0, sizeof(a));
}
friend Matrix operator+ (const Matrix &a, const Matrix &b)
{
assert(a.n == b.n && a.m == b.m);
Matrix ret(a.n, a.m);
for (int i = 0; i < a.n; ++i) {
for (int j = 0; j < a.m; ++j) {
ret.a[i][j] = (a.a[i][j] + b.a[i][j]) % MOD;
}
}
return ret;
}
friend Matrix operator- (const Matrix &a, const Matrix &b)
{
assert(a.n == b.n && a.m == b.m);
Matrix ret(a.n, b.m);
for (int i = 0; i < a.n; ++i) {
for (int j = 0; j < a.m; ++j) {
ret.a[i][j] = (a.a[i][j] - b.a[i][j] + MOD) % MOD;
}
}
return ret;
}
friend Matrix operator* (const Matrix &a, int b)
{
Matrix ret(a.n, a.m);
for (int i = 0; i < a.n; ++i) {
for (int j = 0; j < a.m; ++j) {
ret.a[i][j] = (LL)a.a[i][j] * b % MOD;
}
}
return ret;
}
friend Matrix operator* (const Matrix &a, const Matrix &b)
{
assert(a.m == b.n);
Matrix ret(a.n, b.m);
for (int i = 0; i < a.n; ++i) {
for (int j = 0; j < b.m; ++j) {
for (int k = 0; k < a.m; ++k) {
ret.a[i][j] = (ret.a[i][j] + (LL)a.a[i][k] * b.a[k][j]) % MOD;
}
}
}
return ret;
}
};
Matrix fpm(Matrix base, int exp)
{
assert(base.n == base.m);
Matrix ret(base.n, base.n);
for (int i = 0; i < base.n; ++i) {
ret.a[i][i] = 1;
}
for (; exp; exp >>= 1) {
if (exp & 1)
ret = ret * base;
base = base * base;
}
return ret;
}
int N, M;
int A[MAXM];
void input()
{
read(N); read(M);
for (int i = 1; i <= M; ++i) {
read(A[i]);
}
}
const int TRANS[3][3] = {
{4, MOD - 2, 1},
{1, 0, 0},
{0, 1, 0}
};
const int INIT[3][3] = {{0}, {1}, {3}};
Matrix trans(3, 3);
Matrix init(3, 1);
void solve()
{
memcpy(trans.a, TRANS, sizeof(TRANS));
memcpy(init.a, INIT, sizeof(INIT));
static int f[MAXM];
static Matrix g[MAXM];
A[++M] = N;
g[0] = Matrix(3, 1);
for (int i = 1; i <= M; ++i) {
Matrix t = fpm(trans, A[i] - A[i - 1]) * g[i - 1];
f[i] = (fpm(trans, A[i]) * init - t).a[0][0];
g[i] = t + init * f[i];
}
int ans = f[M];
printf("%d\n", ans);
}
int main()
{
#ifdef __DEBUG
freopen("E.in", "r", stdin);
freopen("E.out", "w", stdout);
#endif
input();
solve();
return 0;
}
// 日色欲尽花含烟,月明欲素愁不眠。
// -- 李白《长相思·其二》