#include <bits/stdc++.h>
const int N = 1e5 + 100;
const int M = 1e6 + 100;
const long long oo = 2e18;
long long n, m, k, t, q, h, a, b, d, c, e, w, x, y, z;
using namespace std;
long long ar[109];
long long dp[109][100005];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      long long r = dp[i - 1][j];
      long long l = j - ar[i] - 1;
      if (l < 0)
        l = 0;
      else
        l = dp[i - 1][l];
      if (l > r) {
        r = 0;
      }
      r = (r - l) % 1000000007;
      dp[i][j] = ((dp[i][j - 1] % 1000000007) + (r % 1000000007)) % 1000000007;
    }
  }
  cout << dp[n][k] % 1000000007 << endl;
  return 0;
}
