#include <cstdio>
#include <cstdlib>
typedef long long int int64;
int main(){
int n, p;
for(;;){
scanf("%d %d", &n, &p);
if(n == 0 and p == 0) break;
int64 cc[10001][2] = {{1}, {0}};
int now = 0;
for(int lx = 0;lx < n;lx++){
int64 inp; scanf("%lld", &inp);
for(int y = 0;y <= p;y++)
cc[y][1^now] = 0;
for(int y = 0;y <= p;y++)
for(int k = 0;y+inp*k <= p;k++)
cc[y+inp*k][1^now] += cc[y][now];
now ^= 1;
}
printf("%lld\n", cc[p][now]);
}
return 0;
}
沒有留言:
張貼留言