#include <bits/stdc++.h>
using namespace std;
const int MAXN = 128;
const int MAXK = 100000 + 100;
const int MOD = 1e9 + 7;
int a[MAXN], dp[MAXN][MAXK];
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int t = 0; t <= a[i] && j - t >= 0; t++) {
        dp[i][j] = (dp[i][j] + dp[i - 1][j - t]) % MOD;
      }
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
