#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 dp[i][j] = 1;
    else
      return dp[i][j] = 0;
  }
  if (dp[i][j] != -1) return dp[i][j];
  dp[i][j] = 0;
  for (int x = 0; x < min(j, a[i]) + 1; x++)
    dp[i][j] = (dp[i][j] % mod + dp[i - 1][j - x] % mod) % mod;
  return dp[i][j];
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%lld", &n);
  ;
  scanf("%lld", &k);
  ;
  dp[0][0] = 1;
  for (int j = 1; j <= k; j++) dp[0][j] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    ;
    for (int j = 0; j < k + 1; j++) solve(i, j);
  }
  cout << dp[n][k] << "\n";
}
