w1212

chl2023 2023-12-30 10:53:54

#include <bits/stdc++.h>

using namespace std;
int Z=1e9+7;
const int N = 1000 + 10;
int w[N], v[N];
long long f[2][100010];
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> w[i];
	f[0][0]=1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (j >= w[i]) f[i%2][j] = (f[(i-1)%2][j]+f[(i-1)%2][j-w[i]])%Z;
			else f[i%2][j] = f[(i-1)%2][j];
		}
	}
	cout << f[n%2][m];
	return 0;
}