#include <bits/stdc++.h>
using namespace std;
const int MAX = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
long long dp[101][100001], n, k, a[101];
vector<int> last(100001), now(100001);
int main() {
  scanf("%lld %lld", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    for (int j = 0; j <= k; j++) {
      if (j - a[i] > 0) {
        dp[i][j] = (last[j] + MOD) - (last[j - a[i] - 1] + MOD);
        dp[i][j] += 2 * MOD;
        dp[i][j] %= MOD;
      } else {
        dp[i][j] = last[j] + MOD;
        dp[i][j] %= MOD;
      }
      if (i == 1) dp[i][j] = 1;
      if (j != 0)
        now[j] = now[j - 1] + dp[i][j];
      else
        now[j] = dp[i][j];
      now[j] %= MOD;
    }
    swap(now, last);
  }
  printf("%lld\n", dp[n][k]);
  return 0;
}
