#include <bits/stdc++.h>
using namespace std;
bool D[2][501][501];
int N, K;
int main() {
  scanf("%d%d", &N, &K);
  D[0][0][0] = 1;
  for (int i = 1; i <= N; i++) {
    int coin;
    scanf("%d", &coin);
    for (int k = 0; k <= K; k++) {
      for (int j = 0; j <= K; j++) {
        D[1][k][j] = D[0][k][j] || (k >= coin ? D[0][k - coin][j] : 0) ||
                     ((k >= coin && j >= coin) ? D[0][k - coin][j - coin] : 0);
      }
    }
    for (int k = 0; k <= K; k++)
      for (int j = 0; j <= K; j++) D[0][k][j] = D[1][k][j];
  }
  vector<int> ans;
  for (int i = 0; i <= K; i++)
    if (D[0][K][i]) ans.push_back(i);
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
