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