#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const long double Pi = acos(-1), e = 2.718;
const int N = 1e5 + 10, mod = 1e9 + 7;
long long n, k, dp[2][N], a[110], Pre[N];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[n % 2][k] = 1;
  for (int i = n - 1; i >= 0; i--) {
    Pre[0] = dp[(i + 1) % 2][0];
    for (int j = 1; j <= k; j++) {
      Pre[j] = Pre[j - 1] + dp[(i + 1) % 2][j];
      Pre[j] %= mod;
    }
    for (int j = 0; j <= k; j++) {
      dp[(i + 1) % 2][j] = 0;
    }
    for (long long j = 0; j <= k; j++) {
      dp[i % 2][j] += Pre[min(k, j + a[i])] - Pre[min(a[i], j) - 1];
      dp[i % 2][j] += mod;
      dp[i % 2][j] %= mod;
    }
  }
  cout << dp[0][0] << '\n';
  return 0;
}
