#include <bits/stdc++.h>
using namespace std;
const int kk = 1000000007;
long long pow(int x, int y) {
  long long ans = 1;
  for (int i = 0; i < y; i++) {
    ans = ans * x;
  }
  return ans;
}
long long calc_step(int x) {
  long long ans;
  if (x == 0) return 0;
  if (x == 1)
    return 1;
  else if (x == 2)
    return 1;
  else if (x == 3)
    return 2;
  else if (x % 2 == 1) {
    x -= 2;
    int small = x / 2;
    int big = small + 1;
    ans = pow(2, small) + pow(2, big) - 1;
    ans = ans % kk;
    return ans;
  } else {
    x -= 2;
    int div = x / 2;
    ans = pow(2, div + 1) - 1;
    ans = ans % kk;
    return ans;
  }
}
int main() {
  int n, m, tmp;
  cin >> n >> m;
  if (m == 0) {
    int ans0 = calc_step(n + 1);
    cout << ans0 << endl;
  } else {
    vector<int> a(m);
    vector<int> b(1, 0);
    long long ans;
    cin >> a[0];
    b[0] = a[0];
    ans = calc_step(b[0]);
    for (int i = 1; i < m; i++) {
      if (m == 1) break;
      cin >> a[i];
      tmp = a[i] - a[i - 1] - 1;
      b.push_back(tmp);
      ans = ans * calc_step(tmp);
      ans = ans % kk;
    }
    tmp = n - a[m - 1];
    ans = ans * calc_step(tmp);
    ans = ans % kk;
    cout << ans << endl;
    return 0;
  }
}
