#include <bits/stdc++.h>
using namespace std;
bool dp[502][502][502];
int N, K;
int coin[502];
int ans[502], asz;
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &coin[i]);
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = true;
  for (int index = 1; index <= N; index++) {
    for (int cursum = 0; cursum <= 500; cursum++) {
      for (int x = 0; x <= cursum; x++) {
        dp[index][cursum][x] = dp[index - 1][cursum][x];
        if (dp[index][cursum][x]) continue;
        if (cursum < coin[index]) continue;
        dp[index][cursum][x] = dp[index - 1][cursum - coin[index]][x];
        if (dp[index][cursum][x]) continue;
        if (x < coin[index]) continue;
        dp[index][cursum][x] =
            dp[index - 1][cursum - coin[index]][x - coin[index]];
      }
    }
  }
  for (int x = 0; x <= 500; x++) {
    if (!dp[N][K][x]) continue;
    ans[++asz] = x;
  }
  printf("%d\n", asz);
  for (int i = 1; i <= asz; i++) {
    printf("%d", ans[i]);
    (i == asz) ? printf("\n") : printf(" ");
  }
}
