#include <bits/stdc++.h>
using namespace std;
unsigned long long int bc(int n, int k) {
  long long int C[n + 1][k + 1];
  int i, j;
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= min(i, k); j++) {
      if (j == 0 || j == i)
        C[i][j] = 1;
      else
        C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
      C[i][j] %= 1000000007;
    }
  }
  return C[n][k] % 1000000007;
}
long long int ways(long long int gap) {
  unsigned long long int res = 0;
  if (gap == 0) return 1;
  if (gap < 0) return 0;
  long long int n = gap;
  if (n % 2 == 0) {
    for (long long int i = 0; i < (n / 2 + 1); ++i) {
      res += bc(n - i, i);
      res %= 1000000007;
    }
  } else {
    for (long long int i = 0; i < ((n + 1) / 2); ++i) {
      res += bc(n - i, i);
      res %= 1000000007;
    }
  }
  return res % 1000000007;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(m);
  cin >> v[0];
  for (long long int i = 1; i <= (m - 1); ++i) {
    cin >> v[i];
  }
  unsigned long long int res = 1;
  res *= ways(v[0] - 1);
  res %= 1000000007;
  for (long long int i = 1; i <= (m - 1); ++i) {
    res *= ways(v[i] - v[i - 1] - 2);
    res %= 1000000007;
  }
  res *= ways(n - v[m - 1] - 1);
  cout << res % 1000000007;
  return 0;
}
