#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using pill = pair<int, ll>;
using vvi = vector<vi>;
ll gcd(ll a, ll b) {
  ll t;
  while ((t = a % b) != 0) {
    a = b;
    b = t;
  }
  return b;
}
ll fast_exp(ll base, ll n, ll m) {
  if (n == 0) return 1;
  ll t = fast_exp(base, n / 2, m);
  if (n % 2 == 0)
    return (t * t) % m;
  else
    return (((t * t) % m) * base) % m;
}
bool is_set(int i, ll mask) { return (mask >> i) & 1; }
int count_bits(ll mask) {
  int ans = 0;
  for (int i = 0; i < 64; ++i)
    if (is_set(i, mask)) ++ans;
  return ans;
}
int first_bit(ll mask) {
  int i = 0;
  while (i < 64)
    if (is_set(i++, mask)) return i - 1;
  return -1;
}
int const N = 500;
bool dp[N + 1][N + 1][N + 1];
int c[N + 1];
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> c[i];
  dp[0][0][0] = true;
  dp[1][c[1]][0] = true;
  dp[1][0][c[1]] = true;
  for (int i = 1; i <= n; ++i) dp[i][0][0] = true;
  for (int i = 2; i <= n; ++i)
    for (int j = 0; j <= k; ++j)
      for (int l = 0; l <= k; ++l) {
        dp[i][j][l] = dp[i - 1][j][l] or
                      (c[i] <= j ? dp[i - 1][j - c[i]][l] : false) or
                      (c[i] <= l ? dp[i - 1][j][l - c[i]] : false);
      }
  vi ans;
  for (int x = 0; x <= k; ++x)
    if (dp[n][x][k - x]) ans.push_back(x);
  cout << ans.size() << "\n";
  for (auto& x : ans) cout << x << " ";
  cout << "\n";
  return 0;
}
