#include <bits/stdc++.h>
using namespace std;
long long int n, k, a[101];
long long int dp[101][100001];
const int mod = 1000000007;
long long int solve(long long int i, long long int j) {
  if (i == 0) {
    if (j == 0)
      return 1;
    else
      return 0;
  }
  if (dp[i][j] != -1) return dp[i][j];
  long long int ans = 0;
  for (int x = 0; x < min(j, a[i]) + 1; x++)
    ans = (ans % mod + solve(i - 1, j - x) % mod) % mod;
  return dp[i][j] = ans;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%lld", &n);
  ;
  scanf("%lld", &k);
  ;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    ;
  }
  solve(n, k);
  cout << dp[n][k] << "\n";
}
