#include <bits/stdc++.h>
using namespace std;
int n, q, c[505];
short dp[502][502][502];
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> c[i];
  dp[0][0][0] = 1;
  int res = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= q; j++) {
      for (int k = 0; k <= j; k++) {
        dp[i][j][k] = dp[i - 1][j][k];
        if (j - c[i] >= 0) {
          dp[i][j][k] |= dp[i - 1][j - c[i]][k];
          if (k - c[i] >= 0) dp[i][j][k] |= dp[i - 1][j - c[i]][k - c[i]];
        }
        if (i == n && j == q && dp[i][j][k] == 1) res++;
      }
    }
  }
  cout << res << endl;
  for (int k = 0; k <= q; k++) {
    if (dp[n][q][k] == 1) {
      cout << k << " ";
    }
  }
  cout << endl;
  return 0;
}
