#include <bits/stdc++.h>
using namespace std;
bool dp[2][505][505];
int main() {
  int n, k, x;
  cin >> n >> k;
  dp[0][0][0] = true;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    int now = i % 2;
    int last = 1 - now;
    for (int j = 0; j <= k; j++) {
      for (int p = 0; p <= j; p++) {
        dp[now][j][p] = dp[last][j][p];
        if (x <= j) {
          dp[now][j][p] |= dp[last][j - x][p];
          if (x <= p) dp[now][j][p] |= dp[last][j - x][p - x];
        }
      }
    }
  }
  vector<int> res;
  for (int i = 0; i <= k; i++) {
    if (dp[n % 2][k][i]) res.push_back(i);
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++) cout << res[i] << " ";
  cout << endl;
  return 0;
}
