#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long dp[n + 1][k + 1];
  for (long long i = 1; i <= n; i++) {
    dp[0][i] = 0;
  }
  for (long long i = 0; i <= k; i++) {
    dp[i][0] = 1;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      if (a[i - 1] <= j) {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - a[i - 1]]) % 1000000007;
      } else {
        dp[i][j] = dp[i - 1][j] % 1000000007;
      }
    }
  }
  cout << dp[n][k] + 1 << '\n';
  return 0;
}
