#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  bool exist = false;
  int a[100050];
  cin >> n >> m;
  for (int i = (int)0; i < (int)m; ++i) {
    cin >> a[i];
  }
  for (int i = (int)0; i < (int)m - 1; ++i) {
    if (abs(a[i] - a[i + 1]) == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  int N = n + 1 - 2 - m - (m * 2);
  int sum = 0;
  for (int bit = 0; bit < (1 << N); ++bit) {
    sum++;
    sum = sum % 1000000007;
  }
  cout << sum << endl;
  return 0;
}
