#include <bits/stdc++.h>
using namespace std;
int n, m, arr[101];
const int mod = 1000000007;
int dp[101][100010];
int f(int pos, int r) {
  if (pos == n) return r == 0;
  int &sum = dp[pos][r];
  if (~sum) return sum;
  sum = 0;
  for (int i = 0; i <= arr[pos] && i <= r; i++) {
    sum += f(pos + 1, r - i);
    if (sum >= mod) sum -= mod;
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << f(0, m) << '\n';
  return 0;
}
