#include <bits/stdc++.h>
using namespace std;
const int N = 508;
int n, k, c[N];
bool f[N][N], g[N];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) scanf("%d", c + i);
  sort(c, c + n);
  f[0][0] = true;
  for (int i = 0; i < n; i++)
    for (int u = k; u >= 0; u--)
      for (int v = max(k - u, u); v >= 0; v--) {
        if (!f[u][v]) continue;
        if (u + v + c[i] <= k) {
          f[u + c[i]][v] = true;
          v + c[i] > u ? f[v + c[i]][u] = true : f[u][v + c[i]] = true;
        }
      }
  for (int i = 0; i <= k; i++)
    if (f[i][k - i]) g[i] = g[k - i] = true;
  int ans = 0;
  for (int i = 0; i <= k; i++)
    if (g[i]) ans++;
  printf("%d\n", ans);
  for (int i = 0; i <= k; i++)
    if (g[i]) printf("%d ", i);
  return 0;
}
