#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, k;
long long candies[105];
long long dp[105][100005];
long long fun(long long ind, long long val) {
  if (val == k) {
    return dp[ind][val] = 1;
  }
  if (val > k || ind == n) {
    ind = 0;
    val = 0;
    return 0;
  }
  if (dp[ind][val] != -1) return (dp[ind][val]);
  long long ways = 0;
  long long candy = candies[ind];
  for (long long i = 0; i <= candy; i++) {
    ways = ((ways) + (fun(ind + 1, val + i)));
  }
  return dp[ind][val] = (ways + mod) % mod;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> candies[i];
  }
  memset(dp, -1, sizeof(dp));
  long long ans = (fun(0, 0) + mod) % mod;
  cout << ans << '\n';
  return 0;
}
