1 #include2 #define _for(i,a,b) for(int i = (a);i < b;i ++) 3 typedef long long ll; 4 using namespace std; 5 inline ll read() 6 { 7 ll ans = 0; 8 char ch = getchar(), last = ' '; 9 while(!isdigit(ch)) last = ch, ch = getchar();10 while(isdigit(ch)) ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();11 if(last == '-') ans = -ans;12 return ans;13 }14 inline void write(ll x)15 {16 if(x < 0) x = -x, putchar('-');17 if(x >= 10) write(x / 10);18 putchar(x % 10 + '0');19 }20 int N,M;21 int a[101];22 int dp[10003];23 int main()24 {25 N = read(),M = read();26 _for(i,0,N)27 a[i] = read();28 memset(dp,0,sizeof(dp));29 dp[0] = 1;30 _for(i,0,N)31 for(int j = M;j >= 0;j --)32 if(j>=a[i])33 dp[j] += dp[j-a[i]];34 write(dp[3]);35 return 0;36 }