#include <bits/stdc++.h>
using namespace std;
int n, m, arr[101];
const int mod = 1000000007;
int dp[101][100010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  dp[0][0] = 1;
  for (int i = 1; i <= arr[0]; i++) dp[0][i] = 1 + dp[0][i - 1];
  for (int i = 1 + arr[0]; i <= m; i++) dp[0][i] = dp[0][i - 1];
  for (int j = 1; j < n; j++) {
    dp[j][0] = dp[j - 1][0];
    for (int i = 1; i <= m; i++) {
      int en = i;
      int st = max(0, i - arr[j]);
      if (st == 0)
        dp[j][i] = dp[j - 1][en] + dp[j][i - 1];
      else
        dp[j][i] = dp[j - 1][en] - dp[j - 1][st - 1] + dp[j][i - 1];
      if (dp[j][i] >= mod) dp[j][i] -= mod;
    }
  }
  int ans = dp[n - 1][m] - dp[n - 1][m - 1];
  if (ans < 0) ans += mod;
  cout << ans << '\n';
  return 0;
}
