#include <bits/stdc++.h>
using namespace std;
long long arr[110];
long long dp[110][100010] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t != 0) {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    for (int i = 0; i < n; i++) {
      dp[i][0] = 1;
    }
    for (int j = 1; j <= arr[0]; j++) {
      dp[0][j] = (1 + dp[0][j - 1]) % 1000000007;
    }
    for (int j = arr[0] + 1; j <= k; j++) {
      dp[0][j] = dp[0][j - 1] % 1000000007;
    }
    for (int i = 1; i < n; i++) {
      for (int j = 1; j <= arr[i]; j++) {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % 1000000007;
      }
      for (int j = arr[i] + 1; j <= k; j++) {
        dp[i][j] = ((dp[i - 1][j] - dp[i - 1][j - arr[i] - 1] + 1000000007) %
                        1000000007 +
                    dp[i][j - 1] % 1000000007) %
                   1000000007;
      }
    }
    if (k > 0)
      cout << dp[n - 1][k] - dp[n - 1][k - 1];
    else {
      cout << 1;
    }
    cout << "\n";
    t--;
  }
  return 0;
}
