#include <bits/stdc++.h>
using namespace std;
int n;
int dp[2][501][501];
int c[500];
int k;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i <= 500; i++) {
    for (int j = 0; j <= 500; j++) {
      dp[0][i][j] = dp[1][i][j] = 0;
    }
  }
  dp[0][c[0]][c[0]] = 1;
  dp[0][0][0] = 1;
  dp[0][c[0]][0] = 1;
  int curr = 1;
  int prev = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= 500; j++) {
      for (int k = 0; k <= 500; k++) {
        if (k > j)
          dp[curr][j][k] = 0;
        else {
          dp[curr][j][k] = dp[prev][j][k];
          if (j >= c[i]) dp[curr][j][k] |= dp[prev][j - c[i]][k];
          if (k >= c[i]) dp[curr][j][k] |= dp[prev][j - c[i]][k - c[i]];
        }
      }
    }
    swap(curr, prev);
  }
  vector<int> ans;
  for (int i = 0; i <= 500; i++) {
    if (dp[prev][k][i]) ans.push_back(i);
  }
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
