#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 5;
const long long nax = 2e5 + 5;
void min_self(long long& a, long long b) { a = min(a, b); }
void max_self(long long& a, long long b) { a = max(a, b); }
void add_self(long long& a, long long b) { a = (a + b) % mod; }
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (auto& i : a) cin >> i;
  vector<vector<long long>> dp(n, vector<long long>(k + 1));
  for (long long i = 0; i <= 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 k = 0; k <= a[i] && j - k >= 0; k++) {
        add_self(dp[i][j], dp[i - 1][j - k]);
      }
    }
  }
  cout << dp[n - 1][k];
}
