#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 7;
const int maxn = 502;
int m, n, a[maxn];
bool f[maxn][maxn][maxn];
vector<int> res;
void nhap() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
}
void solve() {
  f[0][0][0] = true;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= j; ++k) {
        f[i][j][k] = f[i - 1][j][k];
        if (j >= a[i]) f[i][j][k] = f[i - 1][j][k] || f[i - 1][j - a[i]][k];
        if (k >= a[i]) f[i][j][k] = f[i][j][k] || f[i - 1][j - a[i]][k - a[i]];
      }
}
void print() {
  for (int i = 0; i <= m; ++i)
    if (f[n][m][i]) res.push_back(i);
  cout << res.size() << endl;
  if (res.size())
    for (int i = 0; i <= res.size() - 1; ++i) cout << res[i] << ' ';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  nhap();
  solve();
  print();
}
