#include <bits/stdc++.h>
using namespace std;
const long long m = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, ke;
  cin >> n >> ke;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long dp[n + 1][ke + 1];
  memset(dp, 0, sizeof(dp));
  for (int j = 0; j <= a[1]; j++) {
    dp[1][j] = 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int k = ke; k >= 0; k--) {
      for (int j = 0; j <= a[i]; j++) {
        dp[i][k] = (dp[i][k] % m + dp[i - 1][k - j] % m) % m;
      }
    }
  }
  cout << dp[n][ke] % m << "\n";
  return 0;
}
