#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<vector<int>> dp(n + 1, vector<int>(k + 1, 0));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j - a[i] >= 0) {
        for (int h = j - a[i]; h <= j; h++) {
          dp[i][j] = (dp[i][j] + dp[i - 1][h]) % mod;
        }
      } else
        for (int h = 0; h <= j; h++) dp[i][j] = (dp[i][j] + dp[i - 1][h]) % mod;
    }
  }
  cout << dp[n][k];
}
