#include <bits/stdc++.h>
using namespace std;
const int MAX = 501;
int n, k;
bool d[MAX][MAX][MAX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int j = 0; j < n; j++) {
    int x;
    cin >> x;
    for (int l = 0; l <= k; l++)
      for (int c = 0; c <= l; c++) {
        if (!j && !c && !l)
          d[j][c][l] = 1;
        else if (!j)
          d[j][c][l] = (!c || c == x) && (!l || l == x);
        else
          d[j][c][l] = d[j - 1][c][l] || (l - x >= c && d[j - 1][c][l - x]) ||
                       (c - x >= 0 && d[j - 1][c - x][l - x]);
      }
  }
  int a = 0;
  for (int c = 0; c <= k; c++) a += d[n - 1][c][k];
  cout << a << '\n';
  for (int c = 0; c <= k; c++)
    if (d[n - 1][c][k]) cout << c << " ";
  cout << '\n';
  return 0;
}
