#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  int sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < k)
    cout << "0\n";
  else if (sum == k)
    cout << "1\n";
  else {
    long long int mod = 1000000007;
    vector<vector<long long int>> dp(n + 1, vector<long long int>(k + 1));
    for (long long int i = 0; i <= n; i++) {
      for (long long int j = 0; j <= k; j++) {
        if (j == 0)
          dp[i][j] = 1;
        else if (i == 0)
          dp[i][j] = 0;
        else {
          for (long long int k = 0; k <= a[i - 1]; k++) {
            if (j >= k) {
              dp[i][j] = ((dp[i][j] % mod) + (dp[i - 1][j - k] % mod)) % mod;
            } else
              break;
          }
        }
      }
    }
    cout << dp[n][k] << endl;
  }
  return 0;
}
