/* ID:chenjiong PROG:money LANG:C++ */ #include <stdio.h> #include <string.h> int V,N; int m[30]; int sum; long long cnt; void dfs(int cur,int s) { if ( sum > N ) return; if ( sum == N ) { cnt++; return; } int i; for ( i = s; i < V; i++) { sum += m[i]; dfs(cur + 1,i); sum -= m[i]; } } int main() { freopen("money.in","r",stdin); freopen("money.out","w",stdout); int i; scanf("%d%d",&V,&N); for ( i = 0; i < V; i++) scanf("%d",&m[i]); sum = 0; dfs(0,0); printf("%ld\n",cnt); return 0; }