#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
template <class T>
T max(T *a, long long n) {
  T maxi = a[0];
  for (long long i = 0; i < n; ++i) {
    if (a[i] > maxi) maxi = a[i];
  }
  return maxi;
}
template <class T>
T min(T *a, long long n) {
  T mini = a[0];
  for (long long i = 0; i < n; ++i) {
    if (a[i] < mini) mini = a[i];
  }
  return mini;
}
template <class T>
T sum(T *a, long long n) {
  T s = 0;
  for (long long i = 0; i < n; ++i) {
    s += a[i];
  }
  return s;
}
long long st(long long k, vector<int> p) {
  if (k == 0) {
    return 0;
  } else if (k == 1) {
    return 1;
    p.push_back(1);
  } else if (k == 2) {
    return 1;
    p.push_back(1);
  } else {
    return st(k - 1, p) + st(k - 2, p);
  }
}
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[m];
  for (int i = (0); i < (m); ++i) {
    cin >> a[i];
  }
  long long sum = 0;
  vector<int> p(m);
  sum += st(a[0] + 1, p);
  if (a[1] - a[0] == 1) {
    cout << 0;
    return 0;
  }
  for (int i = (1); i < (m); ++i) {
    sum *= st(a[i] - a[i - 1] + 1, p);
    if (a[i] - a[i - 1] == 1) {
      cout << 0;
      return 0;
    }
  }
  cout << sum / 1000000007;
  return 0;
}
