#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  int n;
  cin >> n;
  int k;
  cin >> k;
  int dp[n + 1][k + 1];
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= k; i++) {
    dp[0][i] = 0;
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = 0;
      for (int l = 0; l <= min(a[i], j); l++) {
        dp[i][j] += (dp[i - 1][j - l] % mod);
      }
    }
  }
  cout << dp[n][k] % mod;
  return 0;
}
