#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  for (auto &x : v) {
    cin >> x;
  }
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, 0));
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      long long limit = v[i - 1];
      for (long long m = 0; m <= limit; m++) {
        if (m <= j) {
          dp[i][j] = (dp[i][j] + dp[i - 1][j - m]) % 1000000007;
        }
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
