#include <bits/stdc++.h>
using namespace std;
int n, K;
int c[505];
bool d[505][505][505];
void read() {
  cin >> n >> K;
  for (int i = 0; i < n; i++) cin >> c[i];
}
void solve() {
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      d[0][i][j] = false;
    }
  }
  d[0][0][0] = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= K; j++) {
      for (int k = j; k <= K; k++) {
        d[i + 1][j][k] = d[i][j][k];
        if (k - c[i] >= 0) {
          d[i + 1][j][k] |= d[i][j][k - c[i]];
          if (j - c[i] >= 0) {
            d[i + 1][j][k] |= d[i][j - c[i]][k - c[i]];
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= K; i++) {
    if (d[n][i][K] == true) ans++;
  }
  cout << ans << endl;
  for (int i = 0; i <= K; i++) {
    if (d[n][i][K] == true) cout << i << " ";
  }
  cout << endl;
}
int main() {
  read();
  solve();
}
