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