#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 5;
long long p = 1000000007;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  long long n, k;
  cin >> n >> k;
  long long dp[n][k + 1];
  long long a[n];
  for (long long i = 0; i < (n); ++i) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (i == 0) {
        if (j <= a[i]) dp[i][j] = 1;
        continue;
      }
      for (int x = 0; x <= a[i] && x <= j; x++) {
        dp[i][j] = (dp[i][j] + dp[i - 1][j - x]) % p;
      }
    }
  }
  cout << dp[n - 1][k];
  return 0;
}
