#include <bits/stdc++.h>
using namespace std;
long long dp[102][100005];
long long mod = 1e9 + 7;
long long solve(long long n, long long k, vector<long long>& v) {
  for (long long j = 0; j <= k; j++) {
    dp[1][j] = (j > v[1]) ? 0 : 1;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j == 0) {
        dp[i][j] = dp[i - 1][j];
      } else {
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j] -
                   ((j - v[i] - 1 >= 0) ? dp[i - 1][j - v[i]] : 0);
        dp[i][j] = (mod + dp[i][j]) % mod;
      }
    }
  }
  return dp[n][k];
}
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> v[i];
  }
  cout << solve(n, k, v) << endl;
  return 0;
}
