#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x);
template <typename T>
void write(T x);
template <typename T>
void writesp(T x);
template <typename T>
void writeln(T x);
const long long N = 5e2 + 2;
long long n, K;
long long c[N];
bool f[N][N];
long long res;
int main() {
  read(n);
  read(K);
  for (register long long i = 1; i <= n; i++) read(c[i]);
  sort(c + 1, c + n + 1);
  f[0][0] = true;
  for (register long long i = 1; i <= n; i++)
    for (register long long j = K; j >= 0; j--)
      for (register long long k = K; k >= 0; k--) {
        if (j >= c[i]) f[j][k] |= f[j - c[i]][k];
        if (k >= c[i]) f[j][k] |= f[j][k - c[i]];
      }
  for (register long long i = 0; i <= K; i++)
    if (f[i][K - i]) ++res;
  writeln(res);
  for (register long long i = 0; i <= K; i++)
    if (f[i][K - i]) writesp(i);
  putchar('\n');
}
template <typename T>
void read(T &x) {
  x = 0;
  int t = 1;
  char wn = getchar();
  while (wn < '0' || wn > '9') {
    if (wn == '-') t = -1;
    wn = getchar();
  }
  while (wn >= '0' && wn <= '9') {
    x = x * 10 + wn - '0';
    wn = getchar();
  }
  x *= t;
}
template <typename T>
void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x <= 9) {
    putchar(x + '0');
    return;
  }
  write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writesp(T x) {
  write(x);
  putchar(' ');
}
template <typename T>
void writeln(T x) {
  write(x);
  putchar('\n');
}
