#include <bits/stdc++.h>
using namespace std;
void fileIO() {}
bool sortbysecdesc(const pair<long long, long long> &a,
                   const pair<long long, long long> &b) {
  return a.second > b.second;
}
long long countWays(vector<long long> a, long long n, long long k) {
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, 0));
  for (long long i = 0; i <= n; i++) dp[i][0] = 1;
  for (long long i = 1; i <= k; i++) dp[0][i] = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      for (long long index = 0; index <= min(a[i - 1], j); index++) {
        dp[i][j] = (dp[i][j] % 1000000007 + dp[i - 1][j - index] % 1000000007) %
                   1000000007;
      }
    }
  }
  return dp[n][k];
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  fileIO();
  long long T;
  T = 1;
  while (T--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    cout << countWays(a, n, k) << "\n";
  }
  return 0;
}
