#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  ;
  long long m = 1e9 + 7;
  vector<vector<long long> > dp(n, vector<long long>(k + 1, 0));
  for (long long i = 0; i <= min(k, a[0]); i++) dp[0][i] = 1;
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      for (long long l = 0; l <= min(j, a[i]); l++)
        dp[i][j] += dp[i - 1][j - l];
      dp[i][j] %= m;
    }
  }
  cout << dp[n - 1][k] << "\n";
  return 0;
}
