#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int ts, kk = 1;
int n, m;
int a[505];
vector<int> rs;
bool qs[505];
bool vs[505][505][505];
void dp(int i, int r, int s) {
  if (r == 0) {
    if (qs[s] == 0) {
      qs[s] = 1;
      rs.push_back(s);
    }
    return;
  }
  if (i == n) return;
  if (vs[i][r][s]) return;
  vs[i][r][s] = 1;
  dp(i + 1, r, s);
  if (r >= a[i]) {
    dp(i + 1, r - a[i], s);
    dp(i + 1, r - a[i], s + a[i]);
  }
}
int main() {
  int t, i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  dp(0, m, 0);
  sort(rs.begin(), rs.end());
  printf("%d\n%d", rs.size(), rs[0]);
  for (i = 1; i < rs.size(); i++) printf(" %d", rs[i]);
  puts("");
  return 0;
}
