#include <bits/stdc++.h>
using namespace std;
const int B = 27397, MOD = 1e9 + 7;
const int B1 = 33941, MOD1 = 1e9 + 9;
const int MAXN = 510;
bool dp[MAXN][MAXN][MAXN];
int N, K;
int c[MAXN];
int main(void) {
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N; ++i) scanf("%d", &c[i]);
  set<int> sol;
  dp[0][0][0] = true;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      for (int k = 0; k <= K; ++k) {
        if (j >= c[i - 1]) dp[i][j][k] |= dp[i - 1][j - c[i - 1]][k];
        if (k >= c[i - 1]) dp[i][j][k] |= dp[i - 1][j][k - c[i - 1]];
        dp[i][j][k] |= dp[i - 1][j][k];
        if (dp[i][j][k] && j + k == K) {
          sol.insert(j);
          sol.insert(k);
        }
      }
    }
  }
  printf("%d\n", (int)sol.size());
  for (auto e : sol) printf("%d ", e);
  printf("\n");
  return 0;
}
