#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long mod = 1000000007;
  long long dp[n + 1][k + 1];
  for (long long i = 0; i <= n; i++) fill(dp[i], dp[i] + k + 1, 0);
  dp[0][0] = 1;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (dp[i][j] == 0) break;
      for (long long l = 0; l <= min(a[i], k - j); l++) {
        dp[i + 1][j + l] += dp[i][j];
        dp[i + 1][j + l] %= mod;
      }
    }
  }
  cout << dp[n][k] << endl;
}
