#include <bits/stdc++.h>
using namespace std;
long long dp[101][300005];
const int mod = 1e9 + 7;
long long a[101];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 3 * k; i >= 3 * k - a[0]; i--) {
    dp[0][i] = 1LL;
  }
  for (int i = 1; i <= 3 * k; i++) {
    dp[0][i] = (dp[0][i] + dp[0][i - 1]) % mod;
  }
  for (int i = 1; i < n; i++) {
    dp[i][0] = dp[i - 1][a[i]];
    for (int j = 1; j <= 3 * k; j++) {
      dp[i][j] =
          (dp[i][j] + dp[i][j - 1] + dp[i - 1][j + a[i]] - dp[i - 1][j - 1]) %
          mod;
    }
  }
  cout << dp[n - 1][0];
}
