#include <bits/stdc++.h>
using namespace std;
int n, k, a[111], md = 1e9 + 7;
int dp[111][100005];
int pre[111][100005];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i <= k; i++) {
    pre[0][i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    for (int j = 0; j <= a[i]; j++) {
      dp[i][j] = pre[i - 1][j];
      sum = (sum + dp[i][j]) % md;
      pre[i][j] = sum;
    }
    for (int j = a[i] + 1; j <= k; j++) {
      dp[i][j] = (2 * md + pre[i - 1][j] - pre[i - 1][j - a[i] - 1]) % md;
      sum = (sum + dp[i][j]) % md;
      pre[i][j] = sum;
    }
  }
  cout << dp[n][k];
  return 0;
}
