#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000000000000000LL;
const int MAX = 505;
int N, K;
int c[MAX];
int dp[2][MAX][MAX];
int main(void) {
  scanf("%d%d", &N, &K);
  for (int i = (0); i < (N); ++i) scanf("%d", c + i);
  memset(dp, 0, sizeof dp);
  for (int t = (0); t < (MAX); ++t)
    for (int k = (0); k < (MAX); ++k) dp[N % 2][t][k] = (t == 0 && k == 0);
  for (int i = N - 1; i >= 0; --i) {
    int I = i % 2;
    for (int t = (0); t < (MAX); ++t)
      for (int k = (0); k < (MAX); ++k) {
        dp[I][t][k] = dp[I ^ 1][t][k];
        if (k >= c[i]) {
          dp[I][t][k] |= dp[I ^ 1][t][k - c[i]];
          if (t >= c[i]) {
            dp[I][t][k] |= dp[I ^ 1][t - c[i]][k - c[i]];
          }
        }
      }
  }
  int cnt = 0;
  for (int i = (0); i < (K + 1); ++i)
    if (dp[0][i][K]) ++cnt;
  printf("%d\n", cnt);
  for (int i = (0); i < (K + 1); ++i)
    if (dp[0][i][K]) printf("%d ", i);
  puts("");
  return 0;
}
