#include <bits/stdc++.h>
using namespace std;
long long int a[101];
long long int dp[101][100001];
long long int total[101][100001];
long long int mod = 1000000007;
int main(void) {
  long long int n;
  long long int k;
  cin >> n >> k;
  a[0] = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  total[0][0] = 1;
  for (long long int j = 1; j <= k; ++j) {
    dp[0][j] = 0;
    total[0][j] = total[0][j - 1] + dp[0][j];
  }
  for (long long int i = 1; i <= n; ++i) {
    total[i][0] = 1;
    for (long long int j = 1; j <= k; ++j) {
      if (j - a[i] <= 0) {
        dp[i][j] = total[i - 1][j];
      } else {
        dp[i][j] = total[i - 1][j] - total[i - 1][j - a[i] - 1];
      }
      total[i][j] = total[i][j - 1] + dp[i][j];
    }
  }
  printf("%lld\n", dp[n][k] % mod);
}
