#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int MAXN = 1e5 + 10;
long long dp[105][MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  memset(dp, 0, sizeof(dp));
  vector<int> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < v[0] + 1; i++) dp[0][k - i] = 1;
  for (long long i = 1; i < n; i++) {
    long long sum = 0;
    for (int j = k; j >= 0; j--) {
      sum = (sum + dp[i - 1][j]) % mod;
      dp[i][j] = sum;
      if (k - j >= v[i]) sum -= dp[i - 1][j + v[i]];
    }
  }
  cout << dp[n - 1][0] << "\n";
  return 0;
}
