#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
priority_queue<long long, vector<long long>, greater<long long> > pq1;
long long n, k;
long long arr[110];
long long dp[110][100010];
long long solve(long long i, long long k) {
  if (i == 0 && k <= arr[0]) return 1;
  if (i <= 0) return 0;
  if (k == 0) return 1;
  if (dp[i][k] != -1) return dp[i][k];
  long long ans = 0;
  for (long long j = min(k, arr[i]); j >= 0; j--) {
    ans = (ans + solve(i - 1, k - j)) % 1000000007;
  }
  return dp[i][k] = ans;
}
int main() {
  if (fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (long long i = 0; i < 101; i++) {
    for (long long j = 0; j < 100010; j++) {
      dp[i][j] = -1;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << solve(n - 1, k);
  return 0;
}
