#include <bits/stdc++.h>
using namespace std;
unsigned long long int dp[101][100001];
unsigned long long int candies2(unsigned long long int *a, int n, int k) {
  for (int i = 0; i <= k; i++) {
    dp[1][i] = (i > a[1]) ? 0 : 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j == 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = (1000000007 + dp[i][j - 1] + dp[i - 1][j] -
                    ((j - a[i] - 1 >= 0) ? dp[i - 1][j - a[i] - 1] : 0)) %
                   1000000007;
    }
  }
  return dp[n][k];
}
int main() {
  int n, k;
  cin >> n >> k;
  unsigned long long int *a = new unsigned long long int[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  unsigned long long int ans = candies2(a, n, k) % 1000000007;
  cout << ans << endl;
}
