#include <bits/stdc++.h>
using namespace std;
const int N = 501;
int n, m, a[N];
bool dp[2][N][N];
vector<int> sol;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  dp[0][0][0] = dp[0][a[0]][0] = dp[0][a[0]][a[0]] = true;
  int at = 0;
  for (int i = 1; i < n; ++i) {
    at ^= 1;
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= m; ++k) {
        dp[at][j][k] = dp[at ^ 1][j][k];
        if (a[i] <= j) dp[at][j][k] |= dp[at ^ 1][j - a[i]][k];
        if (a[i] <= j && a[i] <= k && k <= j)
          dp[at][j][k] |= dp[at ^ 1][j - a[i]][k - a[i]];
      }
  }
  for (int i = 0; i <= m; ++i)
    if (dp[at][m][i]) sol.push_back(i);
  printf("%d\n", (int)sol.size());
  for (int i = 0; i < (int)sol.size(); ++i)
    printf("%s%d", i ? " " : "", sol[i]);
  puts("");
  return 0;
}
