#include <bits/stdc++.h>
using namespace std;
bool dp[2][505][505];
int C = 501;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i <= C; i++)
    for (int j = 0; j <= C; j++) dp[0][i][j] = 0;
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    int di = i & 1;
    int c;
    cin >> c;
    for (int i = 0; i <= C; i++)
      for (int j = 0; j <= C; j++) dp[di ^ 1][i][j] = 0;
    for (int i = 0; i <= C; i++)
      for (int j = 0; j <= C; j++) {
        if (i + c <= C) dp[di ^ 1][i + c][j] |= dp[di][i][j];
        if (j + c <= C) dp[di ^ 1][i][j + c] |= dp[di][i][j];
        dp[di ^ 1][i][j] |= dp[di][i][j];
      }
  }
  int ri = n & 1;
  vector<int> ans;
  for (int i = 0; i <= k; i++)
    if (dp[ri][i][k - i]) ans.push_back(i);
  cout << ans.size() << endl;
  for (int i = 0; i < (int)ans.size(); i++)
    cout << ans[i] << " \n"[i == (int)ans.size() - 1];
  return 0;
}
