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