#include <bits/stdc++.h>
using namespace std;
template <typename T>
void vec_print(vector<T> VEC) {
  for (long long i = (long long)0; i < (long long)VEC.size(); ++i) {
    cout << VEC[i] << " ";
  }
  cout << "\n";
};
template <typename T>
void mat_print(vector<vector<T>> MAT) {
  for (long long i = (long long)0; i < (long long)MAT.size(); ++i) {
    for (long long j = (long long)0; j < (long long)MAT[i].size(); ++j) {
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};
template <typename CLASS1, typename CLASS2>
class HOGE {
 public:
  CLASS1 key;
  CLASS2 value;
  HOGE(void) { return; };
  HOGE(CLASS1 key, CLASS2 value) {
    this->key = key;
    this->value = value;
  };
  ~HOGE(void) { return; };
  void print(void) {
    cout << "key : " << key << ", value : " << value << "\n";
    return;
  };
  bool operator==(const HOGE &obj) { return (this->value == obj.value); };
  bool operator<(const HOGE &obj) { return (this->value < obj.value); };
  bool operator>(const HOGE &obj) { return (this->value > obj.value); };
};
constexpr int INF = (1 << 30);
constexpr long long INFLL = 1LL << 62;
constexpr long double EPS = 1e-12;
constexpr long long MOD = (long long)((1E+9) + 7);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, K;
  cin >> N >> K;
  vector<long long> a(N);
  for (long long i = (long long)0; i < (long long)N; ++i) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(2, vector<long long>(K + 1, 0));
  for (long long j = (long long)0; j < (long long)a[0] + 1; ++j) {
    dp[0][j] = 1;
  }
  for (long long i = (long long)1; i < (long long)N; ++i) {
    long long tmp = 0;
    for (long long j = (long long)0; j < (long long)K + 1; ++j) {
      tmp += dp[0][j] % MOD;
      dp[1][j] += tmp % MOD;
      if (j >= a[i]) tmp -= dp[0][j - a[i]];
      while (tmp < 0) tmp += MOD;
    }
    swap(dp[0], dp[1]);
  }
  cout << dp[0][K] % MOD << "\n";
  return 0;
}
