#include <bits/stdc++.h>
using namespace std;
int n, m, a[501], A[501];
bool f[501][501][501];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[0][0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= m; j++)
      for (int k = 0; k <= m; k++) {
        f[i][j][k] = f[i - 1][j][k];
        if (j >= a[i]) f[i][j][k] = f[i][j][k] || f[i - 1][j - a[i]][k];
        if (k >= a[i] && j >= a[i])
          f[i][j][k] = f[i][j][k] || f[i - 1][j - a[i]][k - a[i]];
      }
  for (int i = 0; i <= m; i++)
    if (f[n][m][i]) A[++A[0]] = i;
  sort(A + 1, A + 1 + A[0]);
  printf("%d\n", A[0]);
  for (int i = 1; i <= A[0]; i++) printf("%d ", A[i]);
  return 0;
}
