#include <bits/stdc++.h>
using namespace std;
const long long int N = ((long long int)1e5) + 5;
const long long int M = ((long long int)1e2) + 5;
const long long int llinf = (long long int)1e18;
const int inf = INT_MAX;
long long int n, k;
long long int arr[M];
long long int dp[M][N];
long long int topla(long long int a, long long int b) {
  return ((a % ((int)(1e9) + 7)) + (b % ((int)(1e9) + 7))) % ((int)(1e9) + 7);
}
long long int f(long long int x, long long int rem) {
  if (x == n + 1 && rem != 0) return 0;
  if (x == n + 1 && rem == 0) return 1;
  if (rem == 0) return 1;
  if (dp[x][rem] != -1) return dp[x][rem];
  long long int top = 0;
  for (long long int i = 0; i <= arr[x]; i++) {
    if (rem - i >= 0) top = topla(top, f(x + 1, rem - i));
  }
  return dp[x][rem] = top;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  memset(dp, -1, sizeof dp);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  cout << f(1, k) << "\n";
}
