#include <bits/stdc++.h>
using namespace std;
bool dp[500][501][501];
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0), cout.precision(15);
  memset(dp, 0, sizeof(dp));
  int n, k;
  cin >> n >> k;
  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  dp[0][0][0] = true;
  if (c[0] <= k) {
    dp[0][c[0]][0] = true;
    dp[0][0][c[0]] = true;
  }
  vector<int> ans;
  for (int i = 1; i < n; i++) {
    for (int x = 0; x <= k; x++) {
      for (int y = 0; y <= k; y++) {
        if (dp[i - 1][x][y]) {
          dp[i][x][y] = true;
          if (x + c[i] <= k) {
            dp[i][x + c[i]][y] = true;
          }
          if (y + c[i] <= k) {
            dp[i][x][y + c[i]] = true;
          }
        }
      }
    }
  }
  for (int x = 0; x <= k; x++) {
    if (dp[n - 1][x][k - x]) {
      ans.push_back(x);
    }
  }
  int q = ans.size();
  cout << q << endl;
  for (int i = 0; i < q; i++) {
    if (i > 0) {
      cout << ' ';
    }
    cout << ans[i];
  }
  cout << endl;
  return 0;
}
