#include <bits/stdc++.h>
using namespace std;
const int maxn = 503;
bitset<maxn> dp[maxn];
int main() {
  int n, k, c;
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 0; i <= k; i++) dp[i].reset();
    dp[0].set(0);
    while (n--) {
      scanf("%d", &c);
      for (int i = k; i >= 0; i--)
        if (i - c >= 0) {
          dp[i] |= dp[i - c];
          dp[i] |= (dp[i - c] << c);
        }
    }
    printf("%d\n", dp[k].count());
    int fi = 1;
    for (int i = 0; i < maxn; i++)
      if (dp[k].test(i)) fi ? printf("%d", i), fi = 0 : printf(" %d", i);
    puts("");
  }
  return 0;
}
