#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
const int MAXN = 550;
int n, k, a, tmp, last, cnt = 0;
bool dp[2][MAXN][MAXN];
int main() {
  ios::sync_with_stdio(false);
  n = read();
  k = read();
  memset(dp, false, sizeof(dp));
  dp[0][0][0] = true;
  for (int i = (1); i <= (n); ++i) {
    tmp = i & 1;
    last = tmp ^ 1;
    a = read();
    for (int j = (0); j <= (k); ++j) {
      for (int l = (0); l <= (j); ++l) {
        if (dp[last][j][l]) {
          dp[tmp][j][l] = true;
          continue;
        }
        if (j >= a && dp[last][j - a][l]) {
          dp[tmp][j][l] = true;
          continue;
        }
        if (l >= a && dp[last][j - a][l - a]) {
          dp[tmp][j][l] = true;
          continue;
        }
      }
    }
  }
  for (int i = (0); i <= (k); ++i)
    if (dp[tmp][k][i]) cnt++;
  cout << cnt << endl;
  for (int i = (0); i <= (k); ++i)
    if (dp[tmp][k][i]) cout << i << " ";
  cout << endl;
}
