#include <bits/stdc++.h>
using namespace std;
short int dp[501][501][501];
short int func(short int i, short int j, short int k) {
  if (i >= 0 && j >= 0 && k >= 0) return dp[i][j][k];
  return 0;
}
int main() {
  short int n, K;
  cin >> n >> K;
  short int c[n];
  short int i, j, k;
  for (i = 0; i < n; i++) cin >> c[i];
  for (i = 0; i < n; i++) {
    dp[i][c[i]][0] = 1;
    dp[i][c[i]][c[i]] = 1;
  }
  for (i = 1; i < n; i++)
    for (j = 0; j <= K; j++)
      for (k = 0; k <= K; k++) {
        if (dp[i][j][k] == 0)
          dp[i][j][k] = func(i - 1, j, k) || func(i - 1, j - c[i], k) ||
                        func(i - 1, j - c[i], k - c[i]);
      }
  vector<short int> reqd;
  for (i = 0; i <= K; i++)
    if (dp[n - 1][K][i]) reqd.push_back(i);
  cout << reqd.size() << endl;
  for (i = 0; i < reqd.size(); i++) cout << reqd[i] << " ";
  ;
}
