#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void print(long long x) {
  static int a[24];
  int n = 0;
  while (x > 0) {
    a[n++] = x % 10;
    x /= 10;
  }
  if (n == 0) a[n++] = 0;
  while (n--) putchar('0' + a[n]);
  putchar('\n');
}
void from(const char *s) { freopen(s, "r", stdin); }
void to(const char *s) { freopen(s, "w", stdout); }
const int N = 510;
bool f[N][N][N];
int c[N];
int main() {
  int n = read(), K = read();
  for (int i = 1; i <= n; i++) c[i] = read();
  f[0][0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= K; j++)
      for (int k = 0; k <= j; k++) {
        f[i][j][k] |= f[i - 1][j][k];
        if (j >= c[i] && k >= c[i]) f[i][j][k] |= f[i - 1][j - c[i]][k - c[i]];
        if (j >= c[i]) f[i][j][k] |= f[i - 1][j - c[i]][k];
      }
  int cnt = 0;
  for (int k = 0; k <= K; k++)
    if (f[n][K][k]) cnt++;
  printf("%d\n", cnt);
  for (int k = 0; k <= K; k++)
    if (f[n][K][k]) printf("%d ", k);
  return 0;
}
