#include <bits/stdc++.h>
using namespace std;
const int N = 501;
bitset<N> visited[N];
bitset<N> answer;
bool were[N];
int c[N];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> c[i];
  for (int iter = 0; iter < 300; ++iter) {
    random_shuffle(c, c + n);
    memset(visited, 0, sizeof(visited));
    memset(were, 0, sizeof(were));
    visited[0][0] = 1;
    were[0] = true;
    for (int j = 0; j < n; ++j) {
      int val = c[j];
      for (int i = k - val; i >= 0; --i)
        if (were[i]) {
          were[i + val] = 1;
          visited[i + val][i + val] = 1;
          visited[i + val] |= visited[i];
        }
    }
    answer |= visited[k];
  }
  vector<int> ans;
  for (int i = 0; i <= k; ++i)
    if (answer[i]) ans.push_back(i);
  sort(ans.begin(), ans.end());
  ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
  cout << ans.size() << endl;
  for (auto x : ans) cout << x << " ";
  return 0;
}
