#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const int inf = 2e9 + 5;
int n, k;
int a[N];
int f[N][N], g[N][N];
void add(int &id, int val) { id = max(id, val); }
void solve() {
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int x = 0; x <= k; x++)
      for (int y = 0; y <= k; y++) g[x][y] = f[x][y];
    for (int x = k; x >= 0; x--)
      for (int y = k; y >= 0; y--) {
        add(f[x][y], g[x][y]);
        if (a[i] <= x) {
          add(f[x][y], g[x - a[i]][y]);
          if (a[i] <= y) add(f[x][y], g[x - a[i]][y - a[i]]);
        }
      }
  }
  set<int> ans;
  for (int s = 0; s <= k; s++)
    if (f[k][s]) ans.insert(s);
  cout << ans.size() << endl;
  for (auto &u : ans) cout << u << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  solve();
}
