#include <bits/stdc++.h>
using namespace std;
const int N = 600;
bool dp[N][N][N];
int a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, i, j, k, l, o, p, q, r;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i + 1];
  }
  for (i = 0; i < n + 1; i++) {
    dp[i][0][0] = true;
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j < N; j++) {
      for (k = 0; k < N; k++) {
        dp[i][j][k] = dp[i - 1][j][k];
        if (j >= a[i]) dp[i][j][k] |= dp[i - 1][j - a[i]][k];
        if (k >= a[i]) dp[i][j][k] |= dp[i - 1][j][k - a[i]];
      }
    }
  }
  vector<int> v;
  for (i = 0; i < m + 1; i++) {
    if (dp[n][i][m - i]) v.push_back(i);
  }
  cout << v.size() << "\n";
  for (i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  return 0;
}
