#include <bits/stdc++.h>
const int maxn = 507;
int coin[maxn], n, m;
int dp[maxn][maxn];
int main(int argc, char const *argv[]) {
  std::ios::sync_with_stdio(false);
  std::cin >> n >> m;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    std::cin >> coin[i];
    sum += coin[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = m; j >= coin[i]; j--) {
      for (int k = 0; k <= j; k++) {
        if (k >= coin[i]) dp[j][k] |= dp[j - coin[i]][k - coin[i]];
        dp[j][k] |= dp[j - coin[i]][k];
      }
    }
  }
  std::vector<int> ans;
  for (int i = 0; i <= m; i++) {
    if (dp[m][i]) ans.push_back(i);
  }
  std::cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); i++) {
    if (i) std::cout << ' ';
    std::cout << ans[i];
  }
  std::cout << std::endl;
  return 0;
}
