#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool mod(long double a, long double b) { return a / b - floor(a / b); }
long long ceil(long long n, long long k) {
  if (k % n == 0) {
    return k / n;
  } else
    return (k / n) + 1;
}
long long occurs(vector<long long> v, long long n) {
  auto it = lower_bound(((v)).begin(), ((v)).end(), (n));
  auto it1 = upper_bound(((v)).begin(), ((v)).end(), (n));
  long long first = it1 - it;
  return first;
}
long long logb(long long base, long long first) {
  return (log(first) / log(base));
}
long long a[3005], dp[105][100005], ps[100][100005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, j, first, t, n, k;
  cin >> n >> k;
  memset(a, 0, sizeof(a));
  memset(dp, 0, sizeof(dp));
  memset(ps, 0, sizeof(ps));
  a[0] = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i + 1];
  }
  dp[1][0] = 1;
  ps[1][0] = 1;
  for (i = 1; i < a[1] + 1; i++) {
    dp[1][i] = 1;
  }
  for (i = 1; i < k + 1; i++) {
    ps[1][i] = ps[1][i - 1] + dp[1][i];
  }
  for (i = 2; i < n + 1; i++) {
    for (j = 0; j < k + 1; j++) {
      if (i - a[i] < 0) {
        dp[i][j] = ps[i - 1][j];
        ps[i][j] = (ps[i][j - 1] + dp[i][j]) % 1000000007;
      } else {
        dp[i][j] = (ps[i - 1][j] - ps[i - 1][j - a[i]] + dp[i - 1][j - a[i]]) %
                   1000000007;
        ps[i][j] = (ps[i][j - 1] + dp[i][j]) % 1000000007;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
