#include <bits/stdc++.h>
using namespace std;
void solve(int n) {
  int k;
  cin >> k;
  vector<int> c(n);
  for (int i = 0; i < n; i++) cin >> c[i];
  char dp[2][k + 1][k + 1];
  memset(dp, 0, sizeof dp);
  dp[0][0][0] = 1;
  int cur = 1;
  for (int i = 0; i < n; i++) {
    memset(dp[cur], 0, sizeof dp[cur]);
    int prev = (cur ^ 1);
    for (int j = 0; j <= k; j++)
      for (int l = 0; l <= j; l++)
        if (dp[prev][j][l]) {
          if (j + c[i] <= k) {
            dp[cur][j + c[i]][l] = 1;
            dp[cur][j + c[i]][l + c[i]] = 1;
          }
          dp[cur][j][l] = 1;
        }
    cur ^= 1;
  }
  vector<int> ans;
  cur ^= 1;
  for (int i = 0; i <= k; i++)
    if (dp[cur][k][i]) ans.push_back(i);
  cout << (int)(ans).size() << '\n';
  for (int x : ans) cout << x << ' ';
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  while (cin >> n) solve(n);
}
