#include <bits/stdc++.h>
using namespace std;
bool dp[505][505][505];
int main() {
  dp[0][0][0] = 1;
  int a, b;
  scanf("%d%d", &a, &b);
  for (int i = 1; i <= a; i++) {
    int c;
    scanf("%d", &c);
    for (int j = 0; j <= b; j++) {
      for (int k = 0; k <= b; k++) {
        dp[i][j][k] = dp[i - 1][j][k];
        if (j >= c) {
          dp[i][j][k] = dp[i][j][k] || dp[i - 1][j - c][k];
          if (k >= c) {
            dp[i][j][k] = dp[i][j][k] || dp[i - 1][j - c][k - c];
          }
        }
      }
    }
  }
  set<int> ans;
  for (int i = 1; i <= a; i++) {
    for (int j = 0; j <= b; j++) {
      if (dp[i][b][j]) {
        ans.insert(j);
      }
    }
  }
  printf("%d\n", ans.size());
  set<int>::iterator it;
  for (it = ans.begin(); it != ans.end(); it++) {
    printf("%d ", *it);
  }
  return 0;
}
