#include <bits/stdc++.h>
int dp[2][501][501] = {0};
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int A[501], i, j, k;
  for (i = 1; i <= N; i++) cin >> A[i];
  dp[0][0][0] = 1;
  int at = 1;
  for (i = 1; i <= N; i++, at = (at + 1) % 2) {
    for (j = 0; j <= 500; j++) {
      for (k = 0; k <= 500; k++) {
        dp[at][j][k] = dp[1 - at][j][k];
        if (j >= A[i]) dp[at][j][k] |= dp[1 - at][j - A[i]][k];
        if (j >= A[i] && k >= A[i])
          dp[at][j][k] |= dp[1 - at][j - A[i]][k - A[i]];
      }
    }
  }
  vector<int> ans;
  for (i = 0; i <= K; i++) {
    if (dp[1 - at][K][i]) ans.push_back(i);
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
