#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  if (b & 1) return a * power(a, b - 1);
  long long int temp = power(a, b / 2);
  return temp * temp;
}
bool mycompare(long long int a, long long int b) { return a > b; }
long long int dp[101][100005];
int solve(vector<int>& a, int i, int n, int k) {
  if (i == n - 1) {
    if (k <= a[i]) return 1;
    return 0;
  }
  if (dp[i][k] != -1) return dp[i][k];
  int ans = 0;
  for (int put = 0; put <= a[i]; put++) {
    ans = (ans + solve(a, i + 1, n, k - put)) % 1000000007;
  }
  return dp[i][k] = ans % 1000000007;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  int dp[n + 1][k + 1];
  memset(dp, 0, sizeof dp);
  for (int c = 0; c <= k; c++) dp[1][c] = (c <= a[1] ? 1 : 0);
  for (int i = 2; i <= n; i++) {
    dp[i][0] = 1;
    for (int c = 1; c <= k; c++) {
      dp[i][c] =
          (dp[i][c - 1] + dp[i - 1][c] -
           ((c - 1 - a[i]) >= 0 ? dp[i - 1][c - 1 - a[i]] : 0) + 1000000007) %
          1000000007;
    }
  }
  cout << (dp[n][k] + 1000000007) % 1000000007;
}
