#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long inf2 = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int mod = 1000000007;
int dp[101][100001];
int n, k;
int a[101];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 0; i <= k; i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
      if (j >= a[i] + 1)
        dp[i][j] = (dp[i][j] + mod - dp[i - 1][j - a[i] - 1]) % mod;
      cerr << i << " " << j << " " << dp[i][j] << endl;
    }
    for (int j = 0; j < k; k++) dp[i][j + 1] = (dp[i + 1][j] + dp[i][j]) % mod;
  }
  printf("%d\n", dp[n][k] - dp[n][k - 1]);
  return 0;
}
