#include <bits/stdc++.h>
using namespace std;
long long n, i, k, candy, X, a[101], S[101][100010];
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) S[i][0] = 1;
  for (candy = 1; candy <= k; candy++) {
    if (candy <= a[1])
      S[1][candy] = S[1][candy - 1] + 1;
    else
      S[1][candy] = S[1][candy - 1];
  }
  for (candy = 1; candy <= k; candy++) {
    for (i = 2; i <= n; i++) {
      if (candy - a[i] > 0)
        X = (S[i - 1][candy] - S[i - 1][candy - a[i] - 1]) % 1000000007;
      else
        X = S[i - 1][candy] % 1000000007;
      if (X < 0) X += 1000000007;
      S[i][candy] += (S[i][candy - 1] + X) % 1000000007;
      if (S[i][candy] < 0) S[i][candy] += 1000000007;
    }
  }
  cout << (S[n][k] - S[n][k - 1]) % 1000000007;
  return 0;
}
