#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int dp[110][N];
int a[N];
int n, k;
long long solve(int i, int sum) {
  if (i == n + 1) return sum == k;
  if (dp[i][sum] != -1) return dp[i][sum];
  long long ret = 0;
  for (int j = 0; j <= min(a[i], k - sum); j++)
    ret = ret + solve(i + 1, sum + j) % 1000000007;
  return dp[i][sum] = ret;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= k; j++) dp[i][j] = -1;
  printf("%lld\n", solve(1, 0));
}
