#include <bits/stdc++.h>
using namespace std;
int down_stairs(const vector<int>& a, int stair_num, int danger) {
  if (stair_num == danger) {
    return 1;
  } else if (stair_num < danger) {
    return 0;
  }
  long result = 0;
  if (stair_num - 1 >= 0) result += down_stairs(a, stair_num - 1, danger);
  if (stair_num - 2 >= 0) result += down_stairs(a, stair_num - 2, danger);
  return result;
}
int main(void) {
  int N, M, danger;
  vector<int> a;
  cin >> N >> M;
  a.push_back(-1);
  for (int i = 0; i < M; ++i) {
    cin >> danger;
    a.push_back(danger);
  }
  long result = 1;
  int pre_danger = N + 1;
  for (int i = 0; i < M + 1; ++i) {
    danger = a.back();
    result *= down_stairs(a, pre_danger - 1, danger + 1);
    a.pop_back();
    pre_danger = danger;
  }
  result = result % 1000000007;
  cout << result << endl;
}
