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