#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, k;
int coin[N], found[N];
bool ok[N][N][N];
void go(int at, int a, int b) {
  if (a > k) return;
  if (a == k) {
    found[b] = 1;
    return;
  }
  if (at > n) return;
  if (ok[at][a][b] == 1) return;
  if (a + coin[at] <= k) {
    go(at + 1, a + coin[at], b + coin[at]);
    go(at + 1, a + coin[at], b);
    go(at + 1, a + coin[at], coin[at]);
  }
  go(at + 1, a, b);
  ok[at][a][b] = 1;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> coin[i];
  }
  go(1, 0, 0);
  int res = 0;
  for (int i = 0; i <= k; i++)
    if (found[i]) res++;
  cout << res << '\n';
  for (int i = 0; i <= k; i++) {
    if (found[i]) cout << i << " ";
  }
  puts("");
  return 0;
}
