#include <bits/stdc++.h>
using namespace std;
const long long logN = 20;
const long long M = 1000000007;
const long long INF = 1e12;
const long long N = 100005;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<vector<int> > dp(n + 1, vector<int>(k + 1, 0));
  dp[0][0] = 1;
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 0; j < k + 1; j++) {
      for (long long p = 0; p < min(a[i - 1], (int)j) + 1; p++) {
        (dp[i][j] += dp[i - 1][j - p]) %= M;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
