#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int tab[107];
long long dp[107][100007];
int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> tab[i];
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    long long x = 0;
    for (int j = 0; j <= K; j++) {
      x += dp[i - 1][j];
      x %= mod;
      dp[i][j] = x;
      if (j >= tab[i]) {
        x -= dp[i - 1][j - tab[i]];
        x %= mod;
      }
    }
  }
  cout << dp[N][K];
}
