#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
const int INF = 0x3f3f3f3f;
vector<int> v(105);
long long dp[105][100010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> v[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = 1;
    for (int j = 1; j <= 100000; j++) {
      if (j > v[i]) {
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - v[i] - 1]);
      } else
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
    }
  }
  cout << dp[n][k];
}
