#include <bits/stdc++.h>
using namespace std;
const long double GOLDEN_RATIO =
    1.6180339887498949025257388711906969547271728515625;
const long double PI = 2.0 * acos(0.0);
const int BLOCK = 333;
long long dp[110][100010];
int N, K, a[110], sum[110];
long long solve(int i, int k) {
  if (dp[i][k] != -1) return dp[i][k];
  if (i == N) return dp[i][k] = !k;
  long long ans = 0;
  for (int j = 0; j <= min(a[i], k); j++)
    ans = (ans + solve(i + 1, k - j)) % 1000000007;
  return dp[i][k] = ans;
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  cout << solve(0, K) << '\n';
  return 0;
}
