#include <bits/stdc++.h>
using namespace std;
int solve(vector<long long int>& arr, int n, int cand) {
  int dp[n + 1][cand + 1];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= cand; j++) {
      for (int k = 0; k <= arr[i - 1] && (j - k) >= 0; k++) {
        dp[i][j] = (dp[i][j] + dp[i - 1][j - k]) % 1000000007;
      }
    }
  }
  return dp[n][cand] % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, x, k;
  cin >> n >> k;
  vector<long long int> arr;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr.push_back(x);
  }
  int ans = solve(arr, n, k);
  cout << ans << "\n";
  return 0;
}
