#include <bits/stdc++.h>
const int N = 100005, MOD = 1e9 + 7;
using namespace std;
int n, k;
long long dp[105][N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  scanf("%d %d", &n, &k);
  for (int i = 0, x; i < n; i++) {
    scanf("%d", &x);
    if (i == 0) {
      for (int j = 0; j <= x; j++) dp[i][j] = 1;
      for (int j = 0; j <= k; j++)
        dp[i][j] = (dp[i][j] + (j ? dp[i][j - 1] : 0)) % MOD;
    } else {
      for (int j = 0; j <= k; j++) {
        if (j <= x)
          dp[i][j] = (dp[i - 1][j] + (j ? dp[i][j - 1] : 0)) % MOD;
        else
          dp[i][j] =
              (dp[i - 1][j] - dp[i - 1][j - x - 1] + MOD + dp[i][j - 1]) % MOD;
      }
    }
  }
  printf("%lld\n", dp[n - 1][k] - dp[n - 1][k - 1]);
}
