#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  cin >> N >> M;
  vector<int> binary(N + 1);
  vector<int> broken(M);
  for (int i = 0; i < M; i++) {
    cin >> broken[i];
  }
  long count = 0;
  while (binary[N] != 1) {
    int sum = 0;
    int i = 0;
    int j = 0;
    while (1) {
      if (sum == N) {
        count++;
        break;
      }
      if (sum == broken[i]) break;
      if (sum > N) break;
      if (binary[j] == 0) {
        sum++;
      } else {
        sum += 2;
      }
      j++;
      if (sum > broken[i]) {
        i++;
      }
    }
    binary[0]++;
    for (int i = 0; i < N; i++) {
      if (binary[i] == 2) {
        binary[i] = 0;
        binary[i + 1]++;
      }
    }
  }
  cout << count % 1000000007 << endl;
}
