#include <bits/stdc++.h>
using namespace std;
int n, k, c[501];
bool zzz[501][501][501];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int a = 0; a <= k; a++) {
    for (int b = 0; b <= k; b++) {
      if (!a && !b) {
        for (int i = 0; i <= n; i++) zzz[a][b][i] = 1;
        continue;
      }
      for (int i = 1; i <= n; i++) {
        zzz[a][b][i] = zzz[a][b][i - 1];
        if (c[i] <= a) zzz[a][b][i] |= zzz[a - c[i]][b][i - 1];
        if (c[i] <= b) zzz[a][b][i] |= zzz[a][b - c[i]][i - 1];
      }
    }
  }
  vector<int> ans;
  for (int t = 0; t <= k; t++) {
    if (zzz[t][k - t][n]) ans.push_back(t);
  }
  cout << ans.size() << '\n';
  for (int a : ans) cout << a << ' ';
  cout << '\n';
  return 0;
}
