#include <bits/stdc++.h>
using namespace std;
int n, K;
int arr[102];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n >> K;
  for (int i = 1; i <= n; ++i) cin >> arr[i];
  int dp[n + 1][K + 1];
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= K; ++j) dp[i][j] = 0;
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int k = 0; k <= K; ++k) {
      if (!k) {
        dp[i][k] = 1;
        continue;
      }
      for (int j = 0; j <= arr[i]; ++j) {
        if (j > k) continue;
        dp[i][k] = (dp[i][k] + dp[i - 1][k - j]) % 1000000007;
      }
    }
  }
  cout << dp[n][K];
}
