#include <bits/stdc++.h>
using namespace std;
void init() {}
int a[505], n;
set<pair<int, pair<int, int> > > S;
set<int> v;
void recur(int i, int k, int sum) {
  if (k == 0) {
    v.insert(sum);
    return;
  }
  if (i == n) return;
  pair<int, pair<int, int> > p;
  p.first = i, p.second.first = k, p.second.second = sum;
  if (S.find(p) != S.end()) return;
  recur(i + 1, k, sum);
  if (a[i] <= k) {
    recur(i + 1, k - a[i], sum);
    recur(i + 1, k - a[i], sum + a[i]);
  }
  S.insert(p);
}
int dp[2][505][505];
vector<int> vec;
int main() {
  int K;
  cin >> n >> K;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int x = i % 2;
    int y = 1 - x;
    for (int j = 0; j <= K; j++) {
      for (int k = 0; k <= j; k++) {
        dp[x][j][k] |= dp[y][j][k];
        if (a[i] <= j) {
          dp[x][j][k] |= dp[y][j - a[i]][k];
          if (a[i] <= k) dp[x][j][k] |= dp[y][j - a[i]][k - a[i]];
        }
      }
    }
  }
  for (int i = 0; i <= K; i++) {
    if (dp[n % 2][K][i]) vec.push_back(i);
  }
  cout << vec.size();
  cout << '\n';
  for (auto it : vec) cout << it << " ";
  return 0;
}
