#include <bits/stdc++.h>
using namespace std;
vector<vector<char>> dp[] = {
    vector<vector<char>>(501, vector<char>(501, false)),
    vector<vector<char>>(501, vector<char>(501, false))};
bool load(int32_t l1, int32_t l2, int32_t l3) {
  if (l2 < 0 || l3 < 0) return false;
  return dp[l1][l2][l3];
}
int main() {
  int32_t n, k;
  cin >> n >> k;
  vector<int32_t> coins;
  coins.reserve(n);
  for (int32_t i = 0; i < n; i++) {
    int32_t c;
    cin >> c;
    coins.push_back(c);
  }
  dp[0][0][0] = true;
  for (int32_t l1 = 0; l1 < n; l1++) {
    int32_t c = coins[l1];
    for (int32_t l2 = 0; l2 <= k; l2++) {
      for (int32_t l3 = 0; l3 <= k; l3++) {
        dp[(l1 & 1) ^ 1][l2][l3] = load(l1 & 1, l2 - c, l3 - c) |
                                   load(l1 & 1, l2 - c, l3) |
                                   load(l1 & 1, l2, l3);
      }
    }
  }
  int32_t cnt = 0;
  for (int32_t i = 0; i <= k; i++) {
    if (dp[n & 1][k][i]) {
      cnt++;
    }
  }
  cout << cnt << '\n';
  for (int32_t i = 0; i <= k; i++) {
    if (dp[n & 1][k][i]) {
      cout << i << ' ';
    }
  }
  return 0;
}
