#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int rec(int index, int left, vector<vector<int>>& dp, vector<int>& candies) {
  if (left < 0) {
    return 0;
  }
  if (index == -1 && left == 0) {
    return 1;
  } else if (index == -1) {
    return 0;
  }
  if (dp[index][left] != -1) {
    return dp[index][left];
  }
  int ans = 0;
  for (int i = 0; i <= candies[index] && i <= left; i++) {
    ans = (ans % mod + (rec(index - 1, left - i, dp, candies)) % mod) % mod;
  }
  return dp[index][left] = ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<vector<int>> dp(n + 1, vector<int>(k + 1, -1));
  vector<int> candies(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> candies[i];
  }
  int ans = rec(n - 1, k, dp, candies);
  cout << ans;
}
