#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double pi = acos(-1);
const long long inf = 1000000000000000005LL;
int n, k, arr[100100], dp[110][100010];
bool hah[110][100010];
long long hitung(long long x, long long y) {
  if (x == n)
    if (y == 0)
      return 1;
    else
      return 0;
  if (hah[x][y]) return dp[x][y];
  for (int i = 0; i <= arr[x]; i++)
    if (y >= i) {
      dp[x][y] = dp[x][y] + hitung(x + 1, y - i);
      dp[x][y] = dp[x][y] % mod;
    }
  hah[x][y] = true;
  return dp[x][y];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) dp[i][0] = 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 1; j <= k; j++) {
      if (i == n - 1) {
        if (j <= arr[i]) {
          dp[i][j] = dp[i][j - 1] + 1;
        } else {
          dp[i][j] = dp[i][j - 1];
        }
      } else {
        int h = j, l = max(0, j - arr[i]);
        dp[i][j] = dp[i][j - 1] +
                   ((l == 0) ? dp[i + 1][h] : dp[i + 1][h] - dp[i + 1][l - 1]);
        dp[i][j] = dp[i][j] % mod;
      }
    }
  }
  cout << (dp[0][k] - dp[0][k - 1]) % mod << "\n";
}
