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