#include <bits/stdc++.h>
#pragma comment(linker, "/stack:640000000")
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI = acos(-1.0);
template <class T>
inline T _abs(T n) {
  return ((n) < 0 ? -(n) : (n));
}
template <class T>
inline T _max(T a, T b) {
  return (!((a) < (b)) ? (a) : (b));
}
template <class T>
inline T _min(T a, T b) {
  return (((a) < (b)) ? (a) : (b));
}
template <class T>
inline T _swap(T &a, T &b) {
  a = a ^ b;
  b = a ^ b;
  a = a ^ b;
}
template <class T>
inline T gcd(T a, T b) {
  return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
  return ((a) / gcd((a), (b)) * (b));
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int t, n, m;
int dp[505][505];
bool dp2[501][501][501];
int arr[505];
set<int> ans;
int call(int pos, int sum) {
  int &ret = dp[pos][sum];
  if (pos == n) {
    return ret = (sum == 0);
  }
  if (ret != -1) return ret;
  int ans = 0;
  ans |= call(pos + 1, sum);
  if (sum - arr[pos] >= 0) ans |= call(pos + 1, sum - arr[pos]);
  return ret = ans;
}
void gen(int pos, int sum, int sum1) {
  if (sum1 > m) return;
  if (pos == n) {
    ans.insert(sum1);
    return;
  }
  bool &ret = dp2[pos][sum][sum1];
  if (ret != 0) return;
  ret = 1;
  if (dp[pos + 1][sum] == 1) {
    gen(pos + 1, sum, sum1);
  }
  if (sum - arr[pos] >= 0 && dp[pos + 1][sum - arr[pos]] == 1) {
    gen(pos + 1, sum - arr[pos], sum1 + arr[pos]);
    gen(pos + 1, sum - arr[pos], sum1);
  }
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    ans.clear();
    memset(dp, -1, sizeof(dp));
    memset(dp2, 0, sizeof(dp2));
    for (int i = 0; i < (n); i++) scanf("%d", &arr[i]);
    call(0, m);
    gen(0, m, 0);
    printf("%d\n", ans.size());
    for (set<int>::iterator it = ans.begin(); it != ans.end(); it++) {
      printf("%d ", (*it));
    }
    puts("");
  }
  return 0;
}
