#include <bits/stdc++.h>
using namespace std;
const long long nmax = 1e9 + 7;
const long long Mod = 998244353;
const double PI = 2 * asin(1);
int N, K, A[100005];
long long DP[105][100005];
bool visited[105][100005];
long long Calc(int Index, int Rest) {
  if (visited[Index][Rest]) return DP[Index][Rest];
  visited[Index][Rest] = true;
  if (Index == N - 1) {
    if (Rest <= A[Index])
      return DP[Index][Rest] = 1;
    else
      return DP[Index][Rest] = 0;
  }
  long long ans = 0;
  for (int i = 0; i <= A[Index]; i++) {
    if (Rest - i >= 0) {
      ans += Calc(Index + 1, Rest - i);
      ans %= nmax;
    } else
      break;
  }
  return DP[Index][Rest] = ans;
}
int main() {
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N; i++) scanf("%d", A + i);
  cout << Calc(0, K) << endl;
  return 0;
}
