#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int n, K;
int A[500 + 9], suff[500 + 9];
vector<int> memo[500 + 9][500 + 9];
int mark[500 + 9][500 + 9] = {0};
int mrk = 0;
vector<int> rec(int i = 0, int rem = K) {
  if (rem == 0) return vector<int>(1, 0);
  if (i == n) return vector<int>();
  if (rem < 0) return vector<int>();
  if (mark[i][rem] == mrk) return memo[i][rem];
  mark[i][rem] = mrk;
  vector<int> ret;
  vector<int> v1 = rec(i + 1, rem - A[i]);
  vector<int> v2 = rec(i + 1, rem);
  vector<int> v3 = v1;
  for (int j = 0, sz = v3.size(); j < sz; j++) v3[j] += A[i];
  vector<int> tmp;
  set_union(((v1).begin()), ((v1).end()), ((v3).begin()), ((v3).end()),
            back_inserter(tmp));
  set_union(((v2).begin()), ((v2).end()), ((tmp).begin()), ((tmp).end()),
            back_inserter(ret));
  return memo[i][rem] = ret;
}
int main() {
  read_file();
  while (scanf("%d%d", &n, &K) != EOF) {
    for (int i = 0; i < n; i++) scanf("%d", &A[i]);
    sort(A, A + n);
    reverse(A, A + n);
    mrk++;
    vector<int> ans = rec();
    int sz = ans.size();
    printf("%d\n", sz);
    for (int i = 0; i < sz; i++) printf("%d%c", ans[i], " \n"[i == sz - 1]);
  }
}
