#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
const int maxn = 1010;
const long long mod = 1000000007;
long long f[maxn];
int A[maxn];
long long pw(int b, int e) {
  if (e == 0) return 1;
  long long x = pw(b, e / 2);
  long long ex = (e % 2 ? b : 1);
  return ((x * ex % mod) % mod * x) % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  f[0] = 1;
  f[1] = 1;
  for (int i = (2); i < (maxn); i++) {
    f[i] = (f[i - 1] * i) % mod;
  }
  int n, m, x;
  cin >> n >> m;
  memset(A, 0, sizeof A);
  long long s = f[n - m];
  {
    cerr << "s"
         << " = " << s << "\n";
  };
  for (int i = (0); i < (m); i++) {
    cin >> x;
    A[x - 1] = 1;
  }
  int i = 0, a, b;
  while (i < n) {
    if (A[i]) break;
    i++;
  }
  a = i;
  i = n - 1;
  while (i >= 0) {
    if (A[i]) break;
    i--;
  }
  b = n - i - 1;
  s = (s * pw(f[a], mod - 2)) % mod;
  s = (s * pw(f[b], mod - 2)) % mod;
  {
    cerr << "s"
         << " = " << s << "\n";
  };
  int c = 0;
  {
    cerr << "a + 1"
         << " = " << a + 1 << "\n";
  };
  {
    cerr << "i"
         << " = " << i << "\n";
  };
  for (int j = (a + 1); j < (i + 1); j++) {
    if (A[j]) {
      if (c == 0) continue;
      s = (s * pw(f[c], mod - 2)) % mod;
      s = (s * pw(2, c - 1)) % mod;
      c = -1;
    }
    c++;
  }
  cout << s << '\n';
  return 0;
}
