#include <bits/stdc++.h>
using namespace std;
long long mod = pow(10, 9) + 7;
int main() {
  int t = 1;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  while (t--) {
    int dp[101][100005];
    int n;
    cin >> n;
    int k;
    cin >> k;
    int arr[101];
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    for (int i = 0; i <= arr[0]; i++) {
      dp[0][i] = 1;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j <= k; j++) {
        for (int m = 0; m <= min(j, arr[i]); m++) {
          dp[i][j] = (dp[i][j] % mod + dp[i - 1][j - m] % mod) % mod;
        }
      }
    }
    cout << dp[n - 1][k];
  }
}
