#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<vector<bool>> a(k + 1, vector<bool>(k + 1, false));
  a[0][0] = true;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    vector<pair<int, int>> next;
    for (int j = 0; j <= k; ++j) {
      for (int l = 0; l <= k - j; ++l) {
        if (a[j][l]) {
          if (j + x <= k) {
            next.emplace_back(j + x, l);
          }
          if (l + x <= k) {
            next.emplace_back(j, l + x);
          }
        }
      }
    }
    for (auto &p : next) {
      a[p.first][p.second] = true;
    }
  }
  vector<int> res;
  for (int i = 0; i <= k; ++i) {
    if (a[i][k - i]) {
      res.push_back(i);
    }
  }
  cout << res.size() << endl;
  for (int x : res) {
    cout << x << ' ';
  }
  return 0;
}
