#include <bits/stdc++.h>
using namespace std;
int n, k, arr[105], dp[105][100005];
int sum2(int a, int b) {
  return ((a % 1000000007) + (b % 1000000007)) % 1000000007;
}
int rek(int ind, int x) {
  if (ind >= n) return int(x == 0);
  if (dp[ind][x] != -1) return dp[ind][x];
  int ret = 0;
  for (int i = 0; i <= min(arr[ind], x); i++) {
    ret = sum2(ret, rek(ind + 1, x - i));
  }
  dp[ind][x] = ret;
  return ret;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << rek(0, k);
  return 0;
}
