#include <iostream>
#include <vector>
#include <numeric>

int main()
{
  int N, M;
  std::cin >> N >> M;
  std::vector<int> v(N, 2), va(N + 2);
  for (int i = 0; i < M; ++i) {
    int x;
    std::cin >> x;
    va[x] = 1;
  }
  if (N != 1)
  	v[N - 2] = 1;
  for (int i = 0; i < N; ++i)
  {
    v[i] -= va[i] + va[i + 1];
  }
  v[N - 1] = 1;
  std::cout << std::accumulate(v.begin(), v.end(), 1l, [](long l, long r) { return (l * r) % 1'000'000'007; }) << std::endl;
}
