#include <bits/stdc++.h>
const int MXN = 1e6 + 200;
const long long MNN = 2e3 + 520;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int OO = 1e9 + 500;
using namespace std;
int n, k, b[MXN], dp[MXN];
int main() {
  ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
  ;
  cin >> n >> k;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    for (int l = k; l >= 1; l--) {
      for (int j = 1; j <= min(b[i], l); j++) {
        dp[l] = (dp[l] + dp[l - j]) % MOD;
      }
    }
  }
  cout << dp[k];
}
