#include <bits/stdc++.h>
using namespace std;
int c[505], bp[505][505];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  bp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = k - c[i]; j >= 0; --j) {
      if (bp[j][0]) {
        for (int p = 0; p <= j; ++p) {
          if (bp[j][p]) {
            bp[j + c[i]][p] = 1;
            bp[j + c[i]][p + c[i]] = 1;
          }
        }
      }
    }
  }
  int count = 0;
  for (int i = 0; i <= k; ++i)
    if (bp[k][i]) ++count;
  cout << count << '\n';
  for (int i = 0; i <= k; ++i)
    if (bp[k][i]) cout << i << " ";
  return 0;
}
