#include <bits/stdc++.h>
using namespace std;
long long a[105];
long long dp[105][100005];
vector<long long> sum(100005, 0), new_sum(100005, 0);
long long add(long long a, long long b) {
  long long res = a + b;
  if (res >= 1000000007) return res - 1000000007;
  return res;
}
long long mult(long long a, long long b) {
  long long res = a;
  res *= b;
  if (res >= 1000000007) return res % 1000000007;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 0; i < k + 1; i++) sum[i] = 1;
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 0; j < k + 1; j++) {
      dp[i][j] = sum[j];
      if (j - a[i] - 1 >= 0) dp[i][j] = add(dp[i][j], -sum[j - a[i] - 1]);
      new_sum[j] = dp[i][j];
      if (j - 1 >= 0) new_sum[j] = add(new_sum[j], new_sum[j - 1]);
    }
    sum = new_sum;
  }
  long long ans = dp[n][k];
  cout << ans << "\n";
  return 0;
}
