#include <bits/stdc++.h>
using namespace std;
long long int mpow(long long int base, long long int exp);
void ipgraph(long long int m);
long long int dx[] = {-1, 0, 1, 0};
long long int dy[] = {0, 1, 0, -1};
const long long int mod = 1e9 + 7;
const long long int MAXN = 105;
long long int n, k, a[MAXN];
long long int dp[MAXN][100005];
long long int solve(long long int idx, long long int candies) {
  if (idx == n) {
    if (candies == 0)
      return 1;
    else
      return 0;
  }
  if (dp[idx][candies] != -1) return dp[idx][candies];
  long long int ans = 0;
  for (long long int x = 1; x <= a[idx]; ++x) {
    if (x <= candies)
      ans = (ans % mod + solve(idx + 1, candies - x) % mod) % mod;
  }
  return dp[idx][candies] = ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (long long int i = 0; i < n; ++i) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  long long int result = solve(0, k);
  cout << result << "\n";
  return 0;
}
