#include using namespace std; using i64 = long long; #define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++) i64 dp[303][303 * 303]; i64 MOD = 1e9 + 7; int main(){ int N,K; cin >> N >> K; dp[0][0] = 1; rep(i,0,N - 1){ int a; cin >> a; } rep(i,0,N - 1){ i64 sum = 0; rep(j,0,K){ sum = (sum + dp[i][j]) % MOD; dp[i + 1][j] = sum; if(j - i >= 0){ sum = (sum - dp[i][j - i] + MOD) % MOD; } } } i64 ans = 0; rep(i,0,K){ ans = (ans + dp[N][i]) % MOD; } cout << ans << endl; }