#include <bits/stdc++.h>
using namespace std;
vector<int> answer;
int n, m, c;
bool A[600][600][600];
int main() {
  scanf("%d%d", &n, &m);
  A[0][0][0] = true;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &c);
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= j; ++k) {
        A[i][j][k] = A[i - 1][j][k];
        if (j < c) continue;
        A[i][j][k] = A[i][j][k] | A[i - 1][j - c][k];
        if (k >= c) A[i][j][k] = A[i][j][k] | A[i - 1][j - c][k - c];
      }
  }
  for (int i = 0; i <= m; ++i)
    if (A[n][m][i]) answer.push_back(i);
  printf("%d\n", answer.size());
  for (int i = 0; i < answer.size(); ++i) printf("%d ", answer[i]);
}
