#include <bits/stdc++.h>
using namespace std;
int n, k, a;
int dp[101][1000001];
int main() {
  cin >> n >> k;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    dp[i][0] = 1;
    for (int j = 1; j <= k; j++)
      for (int t = 0; t <= a && j - t >= 0; t++)
        dp[i][j] = (dp[i][j] + dp[i - 1][j - t]) % int(1e9 + 7);
  }
  cout << dp[n][k] << endl;
}
