#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int N, K;
int a[110];
int dp[110][100010];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    int sum[100010];
    sum[0] = 0;
    for (int j = 0; j <= K; j++) sum[j + 1] = (sum[j] + dp[i - 1][j]) % mod;
    for (int j = 0; j <= K; j++)
      dp[i + 1][j] = (sum[j + 1] - sum[max(0, j - a[i])] + mod) % mod;
  }
  cout << dp[N][K] << endl;
  return 0;
}
