#include <bits/stdc++.h>
using namespace std;
const int N = 501;
int n, K, a[N];
bitset<501> B[2][N], I;
bool ok[2][N];
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 0; i < (n); ++i) scanf("%d", a + i);
  int c = 0;
  for (int i = 0; i < (K + 1); ++i) ok[c][i] = false;
  ok[c][0] = true;
  B[c][0][0] = 1;
  for (int i = 0; i < (n); ++i) {
    c ^= 1;
    for (int j = 0; j < (K + 1); ++j) ok[c][j] = false, B[c][j] = I;
    for (int j = 0; j < (K + 1); ++j)
      if (ok[c ^ 1][j]) {
        ok[c][j] = true;
        B[c][j] |= B[c ^ 1][j];
        if (j + a[i] <= K) {
          int t = j + a[i];
          ok[c][t] = true;
          B[c][t] |= B[c ^ 1][j] | (B[c ^ 1][j] << a[i]);
        }
      }
  }
  vector<int> ans;
  for (int i = 0; i < (K + 1); ++i)
    if (B[c][K][i] == 1) ans.push_back(i);
  printf("%d\n", (int)(ans).size());
  for (int i = 0; i < ((int)(ans).size()); ++i)
    printf("%d%c", ans[i], " \n"[i + 1 == (int)(ans).size()]);
  return 0;
}
