#include <bits/stdc++.h>
using namespace std;
long double pi = 2.0 * acos(0.0);
long long dp[101][100008];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int arr[n + 1];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = (dp[i - 1][j]);
      if (arr[i] < j) {
        int y = dp[i - 1][j - arr[i] - 1];
        dp[i][j] = (dp[i][j] - y) % 1000000007;
      }
    }
    for (int j = 1; j <= k; j++)
      dp[i][j] = (dp[i][j - 1] + dp[i][j]) % 1000000007;
  }
  cout << dp[n][k] % 1000000007 << endl;
  return 0;
}
