#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 500, maxk = 500;
bitset<maxk + 5> dp[maxn + 5][maxk + 5];
int n, K;
int a[maxn + 5];
int main() {
  scanf("%d%d", &n, &K);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) scanf("%d", a + i);
  dp[0][0][0] = 1;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    for (int j = (0), j_end_ = (K + 1); j < j_end_; ++j) {
      dp[i + 1][j] |= dp[i][j];
      if (j + a[i] <= K) dp[i + 1][j + a[i]] |= dp[i][j];
      dp[i + 1][j] |= dp[i][j] << a[i];
    }
  vector<int> ans;
  for (int i = (0), i_end_ = (K + 1); i < i_end_; ++i)
    if (dp[n][i][K - i]) ans.push_back(i);
  printf("%d\n", (int((ans).size())));
  for (auto u : ans) printf("%d ", u);
  return 0;
}
