#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int a[maxn], ans[maxn];
bool d[maxn][maxn], vis[maxn];
int main() {
  int n, m, i, j, k, x, y, z, cnt;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(d, false, sizeof(d));
    for (i = 1; i <= n; i++) scanf("%d", &a[i]);
    d[0][0] = true;
    for (k = 1; k <= n; k++) {
      for (i = m; i >= 0; i--) {
        for (j = 0; j <= i; j++) {
          if (!d[i][j]) continue;
          d[i + a[k]][j] = true;
          d[i + a[k]][j + a[k]] = true;
        }
      }
    }
    cnt = 0;
    for (i = 0; i <= m; i++) {
      if (d[m][i]) ans[++cnt] = i;
    }
    printf("%d\n", cnt);
    for (i = 1; i <= cnt; i++) {
      printf("%d", ans[i]);
      if (i != cnt)
        printf(" ");
      else
        printf("\n");
    }
  }
  return 0;
}
