#include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int LCM(int a, int b) { return (a * b) / (GCD(a, b)); }
long long unsigned int factrical(int k) {
  long long unsigned int sum = 1;
  for (int i = 1; i <= k; i++) {
    sum *= i;
  }
  return sum;
}
int main() {
  long long unsigned int n, m;
  cin >> n >> m;
  vector<long long unsigned int> a(m);
  for (long long unsigned int i = 0; i < m; i++) {
    cin >> a[i];
  }
  long long unsigned int div = 1000000007;
  long long unsigned int cnt = 0;
  bool is_ok = true;
  for (int i = 0; i < n; i++) {
    if (i <= a.back()) {
      for (int j = 0; j < m; j++) {
        if (((i == a[j] and i - 1 == a[j - 1]) or
             (i == a[j] and i + 1 == a[j + 1]))) {
          is_ok = false;
          break;
        }
      }
      if (is_ok) {
        cnt++;
      }
      if (!is_ok) {
        break;
      }
    } else {
      cnt++;
    }
  }
  cout << (is_ok ? cnt % div : 0) << endl;
  return 0;
}
