#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 4, M = 1e5 + 2, MOD = 1e9 + 7;
int n, k;
int arr[N], mem[N][M];
int solve(int idx, int candies) {
  if (candies < 0) return 0;
  if (idx == n) {
    return (candies == 0);
  }
  int &ret = mem[idx][candies];
  if (~ret) return ret;
  ret = solve(idx, candies - 1) + solve(idx + 1, candies) -
        solve(idx + 1, candies - arr[idx] - 1) + 2 * MOD;
  ret %= MOD;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(mem, -1, sizeof mem);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  cout << solve(0, k) % MOD;
  return 0;
}
