#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> dp;
vector<int> v;
int ways(int n, int candies) {
  if (n == 0) {
    int x = v[0];
    if (candies > x) {
      return 0;
    } else {
      return 1;
    }
  }
  if (dp[n][candies] != -1) {
    return dp[n][candies];
  }
  int l = 0, r = v[n];
  int ans = 0;
  for (int i = l; i <= r; i++) {
    if (candies >= i) {
      ans += ways(n - 1, candies - i);
      ans %= 1000000007;
      ;
    }
  }
  return dp[n][candies] = ans;
}
void solve() {
  int n, k;
  cin >> n >> k;
  dp.resize(n, vector<int>(k + 1, -1));
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  cout << ways(n - 1, k) << "\n";
}
int main() {
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cout.precision(10);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
