#include <bits/stdc++.h>
using namespace std;
long long int n, k;
long long int arr[105];
long long int dp[105][100005];
long long int solve(long long int pos, long long int can) {
  if (pos == n) {
    if (can <= arr[pos])
      return 1;
    else
      return 0;
  }
  if (can == 0) return 1;
  if (dp[pos][can] != -1) return dp[pos][can];
  long long int ret = 0;
  long long int mx = min(arr[pos], can);
  for (long long int i = 0; i <= mx; i++) {
    long long int now = solve(pos + 1, can - i);
    ret += now;
    ret %= 1000000007;
  }
  return dp[pos][can] = ret;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%lld%lld", &n, &k);
  for (long long int i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
  }
  long long int ans = solve(1, k);
  printf("%lld\n", ans);
  return 0;
}
