#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
int N, K;
int a[502];
bool mark[502][502][502];
bool M[502];
void proc() {
  memset((mark), (0), sizeof(mark));
  memset((M), (0), sizeof(M));
  mark[0][0][0] = 1;
  for (int(i) = (1); (i) < (N + 1); ++(i))
    for (int(j) = (0); (j) < (K + 1); ++(j))
      for (int(k) = (0); (k) < (j + 1); ++(k)) {
        mark[i][j][k] |= mark[i - 1][j][k];
        int e = a[i - 1];
        if (j >= e) {
          mark[i][j][k] |= mark[i - 1][j - e][k];
          if (k >= e) mark[i][j][k] |= mark[i - 1][j - e][k - e];
        }
        if (j == K) M[k] |= mark[i][j][k];
      }
}
int main() {
  scanf("%d%d", &N, &K);
  for (int(i) = (0); (i) < (N); ++(i)) scanf("%d", &a[i]);
  proc();
  int cnt = 0;
  for (int(i) = (0); (i) < (K + 1); ++(i))
    if (M[i]) cnt++;
  printf("%d\n", cnt);
  for (int(i) = (0); (i) < (K + 1); ++(i))
    if (M[i]) printf("%d ", i);
  puts("");
}
