#include <bits/stdc++.h>
using namespace std;
const long long mod = 1E9 + 7;
int main() {
  int n, k;
  while (cin >> n >> k) {
    long long num[n + 5];
    for (int i = 0; i < n; ++i) cin >> num[i];
    long long dp[n + 5][k + 5];
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i <= num[0]; ++i) dp[0][i] = 1;
    for (int i = 1; i < n; ++i) {
      for (int j = 0; j <= k; ++j) {
        for (int l = 0; l <= num[i] and j + l <= k; ++l) {
          dp[i][j + l] += dp[i - 1][j];
        }
        dp[i][j] %= mod;
      }
    }
    cout << dp[n - 1][k] % mod << '\n';
  }
  return 0;
}
