#include <bits/stdc++.h>
using namespace std;
int n, a[(505)], k;
bool dp[10][(505)][(505)];
bool can[(505)];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    dp[0][0][0] = true;
    dp[1][0][0] = true;
  }
  int c = 1, p = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int h = 0; h <= k; h++) {
        if (!dp[p][j][h]) continue;
        if (h + j == k) {
          can[h] = true;
          can[j] = true;
        }
        if (h + a[i] <= k) dp[c][j][h + a[i]] = true;
        dp[c][j][h] = true;
        if (j + a[i] <= k) dp[c][j + a[i]][h] = true;
      }
    }
    swap(c, p);
  }
  for (int i = 0; i <= 1; i++) {
    for (int j = 0; j <= k; j++) {
      for (int h = 0; h <= k; h++) {
        if (dp[i][j][h] && j + h == k) {
          can[j] = true;
          can[h] = true;
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; i++) {
    if (can[i]) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
