#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
long long a[105];
long long dp[100005][105];
long long f(long long rem, int i) {
  if (dp[rem][i] != -1) return dp[rem][i];
  if (i == n - 1) {
    if (rem <= a[i])
      return dp[rem][i] = 1;
    else
      return dp[rem][i] = 0;
  }
  long long res = 0;
  for (long long k = 0; k <= min(a[i], rem); k++) {
    res += f(rem - k, i + 1);
    res %= 1000000007;
  }
  return dp[rem][i] = res;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof dp);
  cout << f(k, 0);
  return 0;
}
