#include <bits/stdc++.h>
using namespace std;
void sb() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
vector<vector<long long>> dp;
vector<long long> v;
long long n;
long long solve(int quantLeft, int curr) {
  if (curr > n - 1) return (quantLeft == 0);
  if (dp[quantLeft][curr] != -1) return dp[quantLeft][curr];
  dp[quantLeft][curr] = 0;
  for (int i = 0; i <= v[curr]; i++) {
    if (i <= quantLeft) dp[quantLeft][curr] += solve(quantLeft - i, curr + 1);
    dp[quantLeft][curr] %= 1000000007;
  }
  dp[quantLeft][curr] %= 1000000007;
  return dp[quantLeft][curr];
}
int main() {
  long long k;
  cin >> n >> k;
  v = vector<long long>(n);
  dp = vector<vector<long long>>(k + 2, vector<long long>(n + 1, -1));
  for (int i = 0; i < n; i++) cin >> v[i];
  cout << solve(k, 0);
}
