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