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