#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  long long int dp[n][k + 1];
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j <= k; j++) {
      dp[i][j] = 0;
    }
  }
  for (long long int i = 0; i <= a[0]; i++) {
    dp[0][i] = 1;
  }
  for (long long int i = 1; i < n; i++) {
    long long int q = 0;
    for (long long int j = 0; j <= k; j++) {
      q += dp[i - 1][j];
      if (j > a[i]) q -= dp[i - 1][j - a[i]];
      q %= 1000000007;
      q += 1000000007;
      q %= 1000000007;
      dp[i][j] = q;
    }
  }
  cout << dp[n - 1][k];
}
