#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1e9 + 7;
int MAX = 100005;
int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> dp(k + 2);
  vector<int> A(n + 1);
  dp[0] = 1;
  for (int i = 0; i < n; i++) cin >> A[i + 1];
  for (int child = 1; child <= n; child++) {
    for (int used = 0; used < k; used++) {
      dp[used + 1] = (dp[used + 1] + dp[used]) % MOD;
      dp[min(used + A[child], k) + 1] -= dp[used];
    }
  }
  cout << dp[k] << endl;
}
