#include <bits/stdc++.h>
using namespace std;
template <class T>
T Bitcnt(T a) {
  int sum = 0;
  while (a) {
    if (a & 1) sum++;
    a /= 2;
  }
  return sum;
}
template <class T>
T Max3(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
T Lcm(T a, T b) {
  T tmp = __gcd(a, b);
  return (a / tmp) * b;
}
template <class T>
T Pow(T a, T b) {
  T ans = 1;
  T base = a;
  while (b) {
    if (b & 1) ans = (ans * base);
    base = (base * base);
    b /= 2;
  }
  return ans;
}
long long Bigmod(long long a, long long b) {
  long long res = 1;
  long long pw = a % 1000000007LL;
  while (b > 0) {
    if (b & 1) res = (res * pw) % 1000000007LL;
    pw = (pw * pw) % 1000000007LL;
    b /= 2;
  }
  return res;
}
int a_x[] = {1, -1, 0, 0};
int a_y[] = {0, 0, 1, -1};
long long X, Y;
void extend_euclid(long long a, long long b) {
  if (b == 0) {
    X = a;
    Y = 0;
    return;
  }
  extend_euclid(b, a % b);
  long long x, y;
  x = Y;
  y = X - (a / b) * Y;
  X = x;
  Y = y;
}
long long inverse_modulo(long long a, long long b) {
  extend_euclid(a, b);
  return (X + 1000000007LL) % 1000000007LL;
}
struct info {
  int f;
  bitset<505> st;
  info() {}
  info(int _, bitset<505> t) {
    f = _;
    st = t;
  }
} dp[505][505];
int c[505];
bool visit[505][505];
int n, k;
info solve(int pos, int rem) {
  if (pos > n) {
    if (!rem) {
      bitset<505> t;
      t.set(0);
      return info(1, t);
    }
    bitset<505> t;
    return info(0, t);
  }
  if (visit[pos][rem]) return dp[pos][rem];
  visit[pos][rem] = 1;
  info res;
  res = solve(pos + 1, rem);
  if (c[pos] <= rem) {
    info tmp = solve(pos + 1, rem - c[pos]);
    if (tmp.f) {
      bitset<505> now;
      now = tmp.st;
      for (int j = 0; j < 505; j++) {
        if (tmp.st[j]) {
          if (c[pos] + j <= k) now.set(c[pos] + j);
        }
      }
      res.f = 1;
      res.st |= now;
    }
  }
  dp[pos][rem] = res;
  return dp[pos][rem];
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  memset(visit, 0, sizeof visit);
  info ans = solve(1, k);
  cout << ans.st.count() << endl;
  for (int i = 0; i < 505; i++) {
    if (ans.st[i]) printf("%d ", i);
  }
  return 0;
}
