#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
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 <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return SQR(POW(B, P / 2));
}
template <typename T>
inline T Dis(T x1, T y1, T x2, T y2) {
  return sqrt(SQR(x1 - x2) + SQR(y1 - y2));
}
template <typename T>
inline T Angle(T x1, T y1, T x2, T y2) {
  return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T>
inline T DIFF(T a, T b) {
  T d = a - b;
  if (d < 0)
    return -d;
  else
    return d;
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T euclide(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = euclide(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = euclide(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = euclide(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
inline int Set(int N, int pos) { return N = N | (1 << pos); }
inline int Reset(int N, int pos) { return N = N & ~(1 << pos); }
inline bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
int arr[502];
bool dp[502][502][502];
bool pp[502][502][502];
bool vis[502];
int n, k;
int solve(int ind, int mid, int kk) {
  if (ind >= n) {
    if (kk == k) vis[mid] = 1;
    return 1;
  }
  if (kk == k) {
    vis[mid] = 1;
    return 1;
  }
  bool &ret = dp[ind][mid][kk];
  if (pp[ind][mid][kk]) return dp[ind][mid][kk];
  ret = solve(ind + 1, mid, kk);
  if (kk + arr[ind] <= k) ret |= solve(ind + 1, mid, kk + arr[ind]);
  if (kk + arr[ind] <= k && mid + arr[ind] <= k) {
    ret |= solve(ind + 1, mid + arr[ind], kk + arr[ind]);
  }
  pp[ind][mid][kk] = 1;
  return ret;
}
int main() {
  read(n);
  read(k);
  for (int i = 0; i < n; i++) {
    read(arr[i]);
  }
  sort(arr, arr + n);
  bool ret = solve(0, 0, 0);
  int cnt = 0;
  for (int i = 0; i <= k; i++) {
    if (vis[i] == 1) cnt++;
  }
  printf("%d\n", cnt);
  for (int i = 0; i <= k; i++) {
    if (vis[i]) printf("%d ", i);
  }
  printf("\n");
  return 0;
}
