#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int(i) = 0; (i) < (m); (i)++) {
    cin >> a[i];
  }
  long ans = 0;
  for (int i = 0; i < m; i++) {
    int danger = a[i];
    int since;
    if (i == 0) {
      since = 0;
    } else {
      since = a[i - 1] + 1;
    }
    int until = a[i] - 1;
    int dist = until - since;
    int max_two = dist / 2;
    int num = 0;
    if (dist < 0) {
      num = 0;
    } else if (dist == 0 || dist == 1) {
      num = 1;
    } else {
      for (int i = 0; i <= max_two; i++) {
        int max_one = dist - 2 * i;
        if (max_one == 0 || i == 0) {
          num++;
          continue;
        }
        num += i + max_one;
      }
    }
    if (i == 0) {
      ans = num;
    } else {
      ans *= num;
    }
    if (ans >= 1000000007) {
      ans %= 1000000007;
    }
  }
  if (m == 0) {
    int dist = n;
    int max_two = dist / 2;
    if (dist == 1) {
      ans = 1;
    } else {
      for (int i = 0; i <= max_two; i++) {
        int max_one = dist - 2 * i;
        if (max_one == 0 || i == 0) {
          ans++;
          continue;
        }
        ans += i + max_one;
      }
      if (ans >= 1000000007) {
        ans %= 1000000007;
      }
    }
  } else if (m != 0) {
    int since = a[m - 1] + 1;
    int until = n;
    int dist = until - since;
    int max_two = dist / 2;
    long num = 0;
    if (dist == 0 || dist == 1) {
      num = 1;
    } else {
      for (int i = 0; i <= max_two; i++) {
        int max_one = dist - 2 * i;
        if (max_one == 0 || i == 0) {
          num++;
          continue;
        }
        num += i + max_one;
      }
    }
    ans *= num;
    if (ans >= 1000000007) {
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
}
