#include <bits/stdc++.h>
using namespace std;
int main(void) {
  unsigned long long a, b, c;
  vector<unsigned long long> candy;
  cin >> a >> b;
  unsigned long long chart[a + 1][b + 1];
  for (int i = 0; i < b; i++) {
    cin >> c;
    candy.push_back(c);
  }
  sort(candy.begin(), candy.end());
  for (int i = 0; i < a + 1; i++) {
    for (int j = 0; j < b + 1; j++) {
      if (j == 0) {
        chart[i][j] = 1;
        continue;
      } else if (i == 0) {
        chart[i][j] = 0;
        continue;
      }
      if (j <= candy[i - 1]) {
        chart[i][j] = (chart[i - 1][j] + chart[i][j - 1]) % 1000000007;
      } else if (j < candy[i - 1] * 2) {
        chart[i][j] = (chart[i][j - 1] - chart[i - 1][j - candy[i - 1] - 1] +
                       1000000007) %
                      1000000007;
      } else
        chart[i][j] = 0;
    }
  }
  cout << (chart[a][b] + 1000000007) % 1000000007 << endl;
}
