#include <bits/stdc++.h>
using namespace std;
void solve_(std::vector<std::vector<int>>& list, std::vector<int> result, int a,
            int n) {
  std::vector<int> result_ = result;
  result_.push_back(a);
  int sum = 0;
  for (int i = 0; i < result_.size(); i++) {
    sum += result_[i];
  }
  if (sum == n) {
    list.push_back(result_);
  } else if (sum < n) {
    solve_(list, result_, 1, n);
    solve_(list, result_, 2, n);
  }
}
std::vector<std::vector<int>> solve(int n) {
  std::vector<std::vector<int>> list;
  std::vector<int> result;
  solve_(list, result, 1, n);
  solve_(list, result, 2, n);
  return list;
}
std::vector<std::vector<int>> calc_step(std::vector<std::vector<int>>& list) {
  std::vector<std::vector<int>> steps;
  for (int i = 0; i < list.size(); i++) {
    std::vector<int> step;
    int s = 0;
    for (int j = 0; j < list[i].size(); j++) {
      s += list[i][j];
      step.push_back(s);
    }
    steps.push_back(step);
  }
  return steps;
}
std::vector<std::vector<int>> available_step(
    std::vector<std::vector<int>>& list, std::vector<int> forbidden) {
  std::vector<std::vector<int>> steps;
  for (int i = 0; i < list.size(); i++) {
    bool valid = true;
    for (int j = 0; j < list[i].size(); j++) {
      auto s = list[i][j];
      for (int k = 0; k < forbidden.size(); k++) {
        if (s == forbidden[k]) {
          valid = false;
          break;
        }
      }
      if (!valid) {
        break;
      }
    }
    if (valid) {
      steps.push_back(list[i]);
    }
  }
  return steps;
}
int main(int argc, char const* argv[]) {
  int n, m;
  cin >> n >> m;
  if (n > 100000) {
    return -1;
  }
  if (m >= n) {
    return -1;
  }
  vector<int> a;
  for (int i = 0; i < m; i++) {
    unsigned int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  auto x = solve(n);
  auto y = calc_step(x);
  auto z = available_step(y, a);
  int result = z.size() % 1000000007;
  cout << result << endl;
  return 0;
}
