#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18L + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n + 1);
  for (long long x = 1; x <= n; x++) cin >> v[x];
  long long ans[n + 1][k + 1];
  for (long long x = 0; x <= k; x++) {
    if (x <= v[1])
      ans[1][x] = 1;
    else {
      ans[1][x] = 0;
    }
  }
  for (long long x = 2; x <= n; x++) {
    for (long long y = 0; y <= k; y++) {
      if (y == 0)
        ans[x][y] = ans[x - 1][y];
      else
        ans[x][y] = ans[x][y - 1] + ans[x - 1][y] -
                    ((y - v[x] - 1) >= 0 ? ans[x - 1][y - v[x] - 1] : 0);
      ans[x][y] %= 1000000007;
    }
  }
  cout << ans[n][k];
}
