#include <bits/stdc++.h>
using namespace std;
long long n, k, a[105];
long long dp[105][100005];
long long res;
long long ans;
long long solve(long long x, long long y) {
  if (x == n + 1 && y == k) return 1;
  if (y > k || x == n + 1) return 0;
  if (dp[x][y] != -1) return dp[x][y] % 1000000007;
  int res = 0;
  for (int i = 0; i <= a[x]; i++) {
    res += solve(x + 1, y + i);
    res = res % 1000000007;
  }
  return dp[x][y] = res % 1000000007;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(1, 0);
}
