#include <bits/stdc++.h>
using namespace std;
int bstep[100000];
int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    scanf("%d", bstep + i);
  }
  bstep[M] = N + 1;
  int steps = bstep[0] - 1;
  if (steps <= 0) {
    cout << 0 << endl;
    return 0;
  }
  long ways = (bstep[0] - 1) / 2 + 1;
  for (int i = 1; i < M + 1; i++) {
    steps = bstep[i] - bstep[i - 1] - 1;
    if (steps <= 0) {
      cout << 0 << endl;
      return 0;
    }
    ways += steps / 2 + 1;
  }
  cout << ways % 1000000007 << endl;
  return 0;
}
