#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int dp[n + 1][k + 1];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n + 1; i++) dp[i][0] = 1;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < k + 1; j++) {
      for (int l = 0; l < a[i - 1] + 1; l++) {
        if (l <= j) dp[i][j] = (dp[i][j] + dp[i - 1][j - l]) % 1000000007;
      }
    }
  cout << dp[n][k] % 1000000007;
  return 0;
}
