#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n, m, a[100001] = {};
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int dp[100001][100001] = {};
  dp[0][0] = 1;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      (dp[i + 1][i] += dp[i][j]) %= MOD;
      if (j >= a[i]) (dp[i + 1][j] += dp[i][j - a[i]]) %= MOD;
    }
  }
  cout << dp[m][m] << endl;
}
