#include <bits/stdc++.h>
using namespace std;
//14888 ㄱㄱ
int n,m;
bool isused[25];
int num[25];
int total=0;
int cnt=0
void func(int now_n,int total){
if(now_n==n && total==m){
cnt++;
return;
}
func(now_n+1,total);
func(now_n+1,total+num[now_n]);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(int i=0; i<n; i++) {
cin >> num[i];
}
func(0,0);
if(m==0) cnt--;
cout << cnt;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: