#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, j;
  cin >> n >> k;
  int a[n], pre[n];
  cin >> a[0];
  pre[0] = a[0];
  for (i = 1; i < n; i++) {
    cin >> a[i];
    pre[i] = a[i] + pre[i - 1];
  }
  long long int dp[n][k + 1];
  memset(dp, 0, sizeof(dp));
  for (i = 0; i < n; i++) {
    for (j = 0; j <= k; j++) {
      if (j == 0)
        dp[i][j] = 1;
      else if (j > pre[i])
        dp[i][j] = 0;
      else if (i == 0)
        dp[i][j] = 1;
      else {
        for (int k = max(j - a[i], 0); k <= j; k++) {
          dp[i][j] = (dp[i][j] + dp[i - 1][k]) % 1000000007;
        }
      }
    }
  }
  cout << dp[n - 1][k];
}
