#include <bits/stdc++.h>
using namespace std;
long long int ans[101][100001];
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, x, sum = 0;
  long long int const num = 1000000007;
  cin >> n >> k;
  for (int i = 0; i <= n; i++) ans[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    sum = 0;
    for (long long int j = 0; j <= k; j++) {
      if (j <= x) {
        sum += ans[i - 1][j] % num;
        ans[i][j] = sum % num;
      } else {
        sum += (ans[i - 1][j] - ans[i - 1][j - x - 1]) % num;
        ans[i][j] = sum;
      }
    }
  }
  cout << ans[n][k];
}
