#include <bits/stdc++.h>
using namespace std;
int n, k, a, i;
long dp[111][2 << 17], mod = 1e9 + 7;
int main() {
  cin >> n >> k;
  dp[0][k] = 1;
  for (; cin >> a; i++) {
    for (int j = k; j >= 0; j--) {
      dp[i + 1][j] = dp[i][j] + dp[i + 1][j + 1] - dp[i][j + a + 1];
    }
  }
  cout << dp[i][0] % mod << endl;
}
