#include <bits/stdc++.h>
using namespace std;
int search(int x) {
  x /= 2;
  int a = 1;
  for (int i = 0; i < x; ++i) {
    a *= 2;
  }
  return a;
}
int main() {
  long n = 0, m = 0, ans = 0;
  cin >> n >> m;
  bool* a = new bool[n];
  for (int i = 0; i < n; ++i) {
    a[i] = true;
  }
  a[n - 1] = false;
  int tmp;
  for (int i = 0; i < m; ++i) {
    cin >> tmp;
    a[tmp - 1] = false;
  }
  tmp = 1;
  for (int i = 0; i < n; ++i) {
    if (a[i]) {
      ++tmp;
    } else {
      if (tmp == 0) {
        ans = 0;
        break;
      }
      ans += search(tmp);
      tmp = 0;
    }
  }
  cout << ans % 1000000007;
  return 0;
}
