#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5 + 5;
const int MOD = 1e9 + 7;
const long long INF = 1061109567;
const long double EPS = 1e-9;
const long double PI = acos(-1);
int dp[105][MX], arr[MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int N, K;
  cin >> N >> K;
  for (int i = (0); i < (N); i++) cin >> arr[i];
  for (int i = (0); i < (N); i++) {
    for (int j = (1); j < (K + 1); j++)
      dp[i - 1][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % MOD;
    for (int j = (0); j < (K + 1); j++)
      dp[i][j] =
          (dp[i][j] + (dp[i - 1][j] -
                       (j - arr[i] - 1 >= 0 ? dp[i - 1][j - arr[i] - 1] : 0)));
  }
  cout << dp[N][K] << "\n";
}
