#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n, k;
long long dp[101][100010];
long long a[101] = {0};
void solve() {
  memset(dp, 0, sizeof(dp));
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    dp[i][0] = 1;
  }
  for (long long i = 0; i < k + 1; i++) {
    dp[0][i] = (i <= a[0]);
  }
  for (long long i = 1; i < n; i++) {
    for (long long j = 1; j <= k; j++) {
      for (long long l = 0; l <= min(a[i], j); l++) {
        dp[i][j] = ((dp[i][j] % mod) + (dp[i - 1][j - l] % mod)) % mod;
      }
    }
  }
  cout << dp[n - 1][k] << "\n";
}
int main() { solve(); }
