#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n, k, a[105], dp[105][100005];
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= a[1]; i++) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int p = 0; p <= a[i]; p++) {
        if (j - p >= 0) dp[i][j] = (dp[i][j] + dp[i - 1][j - p]) % mod;
      }
    }
  }
  cout << dp[n][k];
}
