#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}
const long long MAXN = 5e2 + 10;
long long n, k, c[MAXN], dp[2][MAXN][MAXN];
vector<long long> vec;
void dp_update() {
  dp[0][0][0] = 1;
  for (long long i = 1; i <= n; i++)
    for (long long j = 0; j <= k; j++)
      for (long long l = 0; l <= j; l++) {
        dp[i & 1][j][l] = dp[i & 1 ^ 1][j][l];
        if (c[i] <= j) {
          dp[i & 1][j][l] |= dp[i & 1 ^ 1][j - c[i]][l];
          if (c[i] <= l) dp[i & 1][j][l] |= dp[i & 1 ^ 1][j - c[i]][l - c[i]];
        }
      }
  for (long long i = 0; i <= k; i++)
    if (dp[n & 1][k][i]) vec.push_back(i);
  return;
}
int32_t main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> c[i];
  dp_update(), cout << (long long)vec.size() << '\n';
  for (auto it : vec) cout << it << " ";
  return 0;
}
