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