#include <bits/stdc++.h>
using namespace std;
int dp[2][505][505], c[505];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, K;
  scanf("%d %d", &n, &K);
  for (int i = 0; i < n; i++) scanf("%d", c + i);
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    memset(dp[(i + 1) & 1], 0, sizeof dp[(i + 1) & 1]);
    for (int j = 0; j <= K; j++) {
      for (int k = 0; k <= K; k++) {
        if (dp[i & 1][j][k]) dp[(i + 1) & 1][j][k] = 1;
        if (dp[i & 1][j][k] && j + c[i] <= K) dp[(i + 1) & 1][j + c[i]][k] = 1;
        if (dp[i & 1][j][k] && k + c[i] <= K) dp[(i + 1) & 1][j][k + c[i]] = 1;
      }
    }
  }
  set<int> second;
  for (int i = 0; i <= K; i++)
    for (int j = 0; j <= K; j++)
      if (dp[n & 1][i][j] && i + j == K) second.insert(i), second.insert(j);
  printf("%d\n", second.size());
  for (set<int>::iterator it = second.begin(); it != second.end(); it++)
    printf("%d ", *it);
  printf("\n");
  return 0;
}
