#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, c[1111][1111], b[1111], zong, ans, a[1111];
int main() {
  scanf("%I64d%I64d", &n, &m);
  b[1] = b[2] = 1;
  for (i = 3; i <= n; ++i) b[i] = (b[i - 1] << 1) % 1000000007;
  c[0][0] = 1;
  for (i = 1; i <= n; ++i) {
    c[i][0] = 1;
    for (j = 1; j <= i; ++j)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % 1000000007;
  }
  for (i = 1; i <= m; ++i) scanf("%I64d", &a[i]);
  sort(a + 1, a + m + 1);
  zong = n - m;
  ans = 1;
  for (i = 1; i <= m; ++i) {
    ans = (ans * c[zong][a[i] - a[i - 1] - 1]) % 1000000007;
    zong -= a[i] - a[i - 1] - 1;
  }
  for (i = 2; i <= m; ++i) {
    ans = (ans * b[a[i] - a[i - 1]]) % 1000000007;
  }
  printf("%I64d", ans);
  return 0;
}
