#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int maxN = 1e5 + 1;
long long dp[101][100001];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> arr;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    arr.push_back(a);
  }
  for (int i = 0; i <= k; i++) {
    if (i == 0)
      dp[0][i] = 1;
    else if (i <= arr[0])
      dp[0][i] = i;
    else
      dp[0][i] = 0;
  }
  for (int i = 1; i < n; i++) {
    dp[i][0] = 1;
    for (int c = 1; c <= arr[i]; c++) {
      dp[i][c] = (dp[i - 1][c] + dp[i][c - 1]) % mod;
    }
    for (int c = arr[i] + 1; c <= k; c++) {
      dp[i][c] =
          (dp[i - 1][c] + dp[i][c - 1] - dp[i - 1][c - arr[i] - 1] + mod) % mod;
    }
  }
  cout << dp[n - 1][k] << endl;
  return 0;
}
