#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
int main(int argc, char const *argv[]) {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (i == 0 and j == 0)
        dp[i][j] = 1;
      else if (i == 0) {
        dp[i][j] = 0;
      } else if (j == 0)
        dp[i][j] = 1;
      else {
        for (long long k = 0; k <= a[i - 1] and j >= k; k++) {
          dp[i][j] += dp[i - 1][j - k];
          dp[i][j] = dp[i][j] % 1000000007;
        }
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
