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