#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k;
int w[550];
bool f[550][550];
bool g[550][550];
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &w[i]);
  memset(g, false, sizeof(g));
  g[n][0] = true;
  for (i = n - 1; i >= 0; i--)
    for (j = 0; j <= m; j++) g[i][j] = g[i + 1][j] || g[i + 1][j - w[i + 1]];
  memset(f, false, sizeof(f));
  if (g[0][m]) f[0][0] = true;
  for (i = 1; i <= n; i++)
    for (j = m; j >= 0; j--)
      for (k = j; k >= 0; k--) {
        if (k >= w[i])
          f[j][k] = (f[j][k] || f[j - w[i]][k - w[i]]) || f[j - w[i]][k];
        else if (j >= w[i])
          f[j][k] = f[j][k] || f[j - w[i]][k];
      }
  int tot = 0;
  for (i = 0; i <= m; i++)
    if (f[m][i]) tot++;
  printf("%d\n", tot);
  int gh = 0;
  for (i = 0; i <= m; i++)
    if (f[m][i]) {
      gh++;
      if (gh == tot)
        printf("%d\n", i);
      else
        printf("%d ", i);
    }
  return 0;
}
