#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
const int MAXK = 100001;
const int MOD = 1000000007;
int N, K, memo[MAXN][MAXK], candies[MAXN];
int dp(int i, int k) {
  if (i == N) {
    if (k == 0) {
      return 1;
    } else {
      return 0;
    }
  }
  if (memo[i][k] != -1) return memo[i][k];
  int res = 0;
  for (int j = 0; k - j >= 0 && j <= candies[i]; j++) {
    res = (res + dp(i + 1, k - j)) % MOD;
  }
  return memo[i][k] = res;
}
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> candies[i];
  }
  memset(memo, -1, sizeof(memo));
  cout << dp(0, K);
}
