#include <bits/stdc++.h>
using namespace std;
bitset<501> pos[501];
bool make[501];
int main(void) {
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  make[0] = true;
  for (int i = 0; i <= k; i++) {
    pos[i][0] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = k; j >= 0; j--) {
      if (a[i] + j <= k && make[j]) {
        make[a[i] + j] = true;
        pos[a[i] + j] |= pos[j];
        pos[a[i] + j] |= pos[j] << a[i];
      }
    }
  }
  cout << pos[k].count() << endl;
  for (int i = 0; i <= k; i++) {
    if (pos[k][i]) {
      cout << i << " ";
    }
  }
  return 0;
}
