#include <bits/stdc++.h>
int count = 0;
int iterator = 0;
void upstair(int current, std::vector<int>::iterator next, int size,
             std::vector<int>::iterator end) {
  int b = *next;
  if (current == size) {
    count++;
    return;
  } else if (current > size)
    return;
  if ((current + 1) == b) {
    auto n = (end == (next + 1)) ? next : next + 1;
    upstair(current + 2, n, size, end);
  } else if ((current + 2) == b) {
    upstair(current + 1, next, size, end);
  } else {
    upstair(current + 1, next, size, end);
    upstair(current + 2, next, size, end);
  }
}
int main() {
  int size, broken;
  std::cin >> size >> broken;
  std::vector<int> buf(broken);
  for (auto &e : buf) std::cin >> e;
  for (auto i = 1; i < buf.size(); ++i) {
    auto diff = buf[i] - buf[i - 1];
    if (diff < 2) {
      std::cout << 0;
      return 0;
    }
  }
  upstair(0, buf.begin(), size, buf.end());
  std::cout << count % (1000000007);
  return 0;
}
