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