#include <bits/stdc++.h>
using namespace std;
int n, K;
int c[500 + 10];
bool dp[500 + 10][500 + 10];
int st[500 + 10], t = 0;
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = K; j >= 0; j--)
      for (int k = K; k >= 0; k--) {
        if (!dp[j][k]) continue;
        if (j + c[i] <= K) dp[j + c[i]][k] = true;
        if (k + c[i] <= K) dp[j][k + c[i]] = true;
      }
  for (int i = 0; i <= K; i++) {
    if (dp[i][K - i]) st[t++] = i;
  }
  printf("%d\n", t);
  for (int i = 0; i < t; i++) {
    if (i) printf(" ");
    printf("%d", st[i]);
  }
  printf("\n");
  return 0;
}
