#include <bits/stdc++.h>
using namespace std;
const int N = 510;
int c[N];
bool dp[N][N][N] = {0};
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", c + i);
  dp[0][c[0]][0] = true;
  dp[0][c[0]][c[0]] = true;
  dp[0][0][0] = true;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int k1 = 0; k1 <= j; k1++) {
        dp[i][j][k1] = dp[i - 1][j][k1];
        if (j - c[i] >= k1) dp[i][j][k1] |= dp[i - 1][j - c[i]][k1];
        if (k1 - c[i] >= 0) dp[i][j][k1] |= dp[i - 1][j - c[i]][k1 - c[i]];
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; i++) {
    if (dp[n - 1][k][i]) ans.push_back(i);
  }
  printf("%d\n", (int)ans.size());
  for (int i : ans) printf("%d ", i);
}
