#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
int n;
int k;
int a[105];
ll dp[105][100005];
int main() {
  cin >> n >> k;
  for (int i = 0; i < (n); i++) cin >> a[i];
  for (int i = 0; i < (n + 1); i++)
    for (int j = 0; j < (k + 1); j++) {
      dp[i][j] = 0;
    }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j - 1 - a[i - 1] >= 0)
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1 - a[i - 1]];
      else
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
      dp[i][j] %= mod;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
