#include <bits/stdc++.h>
using namespace std;
int dp[101][100002];
int n;
vector<int> a;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int k;
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  int x = 0;
  for (int i = 1; i <= n; ++i) {
    x += a[i - 1];
    dp[i][0] = 1;
    for (int j = 1; j <= min(x, k); ++j) {
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % 1000000007;
      if (j - a[i - 1] > 0) {
        dp[i][j] =
            (1000000007 - dp[i][j - a[i - 1] - 1] + dp[i][j]) % 1000000007;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
