#include <bits/stdc++.h>
using namespace std;
long long dp[100005][103];
int n, k;
int a[103];
int p[103];
long long recur(int k1, int l) {
  if (l == n && k1 == 0)
    return 1LL;
  else if (l == n && k1 != 0)
    return 0;
  else if (dp[k1][l] != -1)
    return dp[k1][l];
  else {
    if (k1 > p[l]) {
      dp[k1][l] = 0;
      return 0;
    } else if (l == n - 1) {
      if (a[l] >= k1)
        return 1;
      else
        return 0;
    }
    dp[k1][l] = 0;
    for (int j = max(0, k1 - p[l + 1]); j <= min(a[l], k1); j++) {
      if ((k1 - j) <= p[l + 1])
        dp[k1][l] = (dp[k1][l] + recur(k1 - j, l + 1)) % 1000000007;
    }
    return dp[k1][l];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  p[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) p[i] = p[i + 1] + a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (i == 0) {
        if (j <= a[i])
          dp[j][i] = 1;
        else
          dp[j][i] = 0;
      } else {
        if (j <= a[i]) {
          dp[j][i] = dp[j][i - 1];
          if (j != 0) dp[j][i] = (dp[j][i] + dp[j - 1][i]) % 1000000007;
        } else {
          dp[j][i] = dp[j][i - 1] - dp[j - a[i] - 1][i - 1];
          if (j != 0) dp[j][i] = (dp[j][i] + dp[j - 1][i]) % 1000000007;
        }
      }
    }
  }
  cout << dp[k][n - 1];
}
