#include <bits/stdc++.h>   using namespace std;   const int N = 1005, mod = 1e9 + 7;   int yh[N][N], a[N];   long long kpow(long long a, long long b) {     long long ans = 1;     while (b) {       if (b & 1) ans = ans * a % mod;       a = a * a % mod;       b >>= 1;     }     return ans;   }   int main() {     for (int i = (0); i < (N); ++i) yh[i][0] = 1;     for (int i = (1); i < (N); ++i)       for (int j = (1); j < (N); ++j) {         yh[i][j] = yh[i - 1][j - 1] + yh[i - 1][j];         if (yh[i][j] >= mod) yh[i][j] -= mod;       }     int n, m;     cin >> n >> m;     a[0] = 0;     a[m + 1] = n + 1;     for (int i = (1); i < (m + 1); ++i) cin >> a[i];     sort(a + 1, a + m + 1);     long long ans = 1, k = n - m;     for (int i = (1); i < (m + 2); ++i) {       int c = a[i] - a[i - 1] - 1;       ans = ans * yh[k][c] % mod;       if (i != 1 && i != m + 1 && c) ans = ans * kpow(2, c - 1) % mod;       k -= c;     }     cout << ans <<   n ;     return 0;   }   