#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y);
long long gcd(long long a, long long b);
long long dp[105][300005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= a[1]; i++) dp[1][i] = i + 1;
  for (int i = a[1] + 1; i <= k; i++) dp[1][i] = dp[1][a[1]];
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = (dp[i][j] + dp[i - 1][j]) % 1000000007;
      if (j > 0) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % 1000000007;
      if (j > a[i])
        dp[i][j] =
            (dp[i][j] + 1000000007 - dp[i - 1][j - a[i] - 1]) % 1000000007;
    }
  }
  cout << dp[n][k] - dp[n][k - 1] << "\n";
  return 0;
}
long long power(long long x, long long y) {
  long long res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
