#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int mod = int(1e9 + 7);
int dcmp(const double& a, const double& b) {
  if (fabs(a - b) < 1e-9) return 0;
  return ((a > b) << 1) - 1;
}
template <class T, class T2>
T _f_pow(T a, T2 b) {
  T res = 1LL;
  while (b > 0) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b >>= 1;
  }
  return (res);
}
int OO = 0x3f3f3f3f;
const int N = 1e7 + 5;
const int M = 1e5 + 6;
int n, k;
int a[505];
bool dp[505][505][505];
set<int> ans;
void solve(int i = 0, int take1 = 0, int take2 = 0) {
  if (take1 + take2 == k) {
    ans.insert(take1);
    ans.insert(take2);
    return;
  }
  if (i == n) return;
  bool& ret = dp[i][take1][take2];
  if (ret) return;
  ret = 1;
  solve(i + 1, take1, take2);
  if (take1 + take2 + a[i] <= k) {
    solve(i + 1, take1 + a[i], take2);
    solve(i + 1, take1, take2 + a[i]);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  solve();
  cout << ((int)(ans).size()) << endl;
  for (auto vl : ans) cout << vl << " ";
  cout << endl;
  return 0;
}
