#include <bits/stdc++.h>
using namespace std;
int n, k;
long long dp[101][100001];
long long m = 1000000000 + 7;
int a[101];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++) {
    dp[0][i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= min(a[i], j); l++) {
        dp[i][j] = (dp[i - 1][j - l] % m + dp[i][j] % m) % m;
      }
    }
  }
  cout << dp[n][k] << endl;
}
