#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<int> p(m + 1, 0);
  vector<vector<int>> dp(n + 1, p);
  dp[0][0] = 1;
  for (int i = 1; i < n + 1; i++)
    for (int k = 0; k <= v[i - 1]; k++)
      for (int j = 0; j < m + 1; j++) {
        int val = k;
        if (j - val >= 0)
          dp[i][j] = (dp[i - 1][j - val] + dp[i][j]) % (1000000000 + 7);
      }
  cout << dp[n][m];
  return 0;
}
