#include <bits/stdc++.h>
using namespace std;
long long int dp[102][100003];
int32_t main(void) {
  long long int t = 1;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    for (long long int i = 0; i <= n; i++)
      for (long long int j = 0; j <= k; j++) dp[i][j] = 0;
    for (long long int i = 1; i <= n; i++) dp[i][0] = 1;
    long long int c = 0;
    for (long long int i = 1; i <= n; i++) {
      long long int temp;
      cin >> temp;
      c = c + temp;
      if (c > k) c = k;
      for (long long int j = 1; j <= temp; j++)
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % 1000000007;
      for (long long int j = temp + 1; j <= c; j++) {
        dp[i][j] = dp[i][j - 1] - 1;
        if (dp[i][j] < 0) dp[i][j] += 1000000007;
      }
    }
    cout << dp[n][k] << endl;
  }
}
