#include <bits/stdc++.h>
using namespace std;
void comb(vector<vector<long long int>> &v) {
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int k = 1; k < v.size(); k++) {
    for (int j = 1; j < k; j++) {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
    }
  }
}
int main() {
  int N, M;
  vector<long long int> a;
  cin >> N >> M;
  a.resize(M + 2);
  a[0] = 0;
  for (int i = 1; i <= M; i++) {
    cin >> a[i];
  }
  a[M + 1] = N + 1;
  long long int count = 0;
  long long int ans = 1;
  for (int j = 0; j < M + 1; j++) {
    long long int d = a[j + 1] - a[j] - 1;
    if (d == 0) {
      cout << 0 << endl;
      return 0;
    }
    count = 0;
    for (long long int n = 0; n <= (d + 1) / 3; n++) {
      if (n == (d + 1) / 3)
        count++;
      else {
        vector<vector<long long int>> v(
            d - 2 * n + 1, vector<long long int>(d - 2 * n + 1, 0));
        comb(v);
        count += v[d - 2 * n][n];
      }
    }
    ans *= (count % 1000000007);
  }
  ans = ans % 1000000007;
  cout << ans << endl;
  return 0;
}
