#include <bits/stdc++.h>
using namespace std;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
void Open() {}
const int mod = long long(1e9 + 7), N = 2000 + 5;
int n, k, a[101], mem[101][100005], dp[101][100005];
map<int, int> mp;
int solve(int i = 0, int rem = k) {
  if (!rem) return 1;
  if (i == n) {
    return rem == 0;
  }
  int& ret = mem[i][rem];
  if (~ret) return ret;
  ret = 0;
  for (int ch = 0; ch <= min(rem, a[i]); ch++) {
    ret += solve(i + 1, rem - ch) % mod;
    ret %= mod;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int rem = 1; rem <= k; rem++) {
      dp[i + 1][rem] += dp[i + 1][rem - 1] % mod;
      dp[i + 1][rem] %= mod;
    }
    for (int rem = 0; rem <= k; rem++) {
      int& ret = dp[i][rem];
      ret = 0;
      ret += dp[i + 1][rem] - dp[i + 1][rem - min(rem, a[i]) - 1];
      ret %= mod;
    }
  }
  cout << dp[0][k] << "\n";
}
