#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
long long gcd(long long a, long long b) {
  if (!a) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long n, k, a, b, c, d, x, y, z, m;
long long ans;
vector<long long> arr(100005);
long long dp[109][100005];
long long pre[100005];
void test_case() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i <= arr[1]; i++) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; i++) {
    pre[0] = dp[i - 1][0];
    for (int i = 1; i <= k; i++) {
      pre[i] = (pre[i - 1] + dp[i - 1][k]) % 1000000007;
    }
    for (int j = 0; j <= k; j++) {
      long long r = j;
      long long l = max(0 * 1LL, j - arr[i]);
      long long sum = pre[r];
      if (l > 0) {
        sum = (sum - pre[l - 1]) % 1000000007;
        if (sum < 0) {
          sum += 1000000007;
        }
      }
      dp[i][j] = sum;
    }
  }
  cout << dp[n][k] << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(20);
  int t = 1;
  while (t--) {
    test_case();
  }
}
