#include <bits/stdc++.h>
using namespace std;
int n, k, a[500], dp[2][501][501];
void maxs(int& aa, int b) {
  if (b > aa) aa = b;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
  }
  int crr = 0, prev = 1;
  for (int i = (0); i < (n); i++) {
    for (int j = (0); j < (k + 1); j++) {
      for (int sm = (0); sm < (k + 1); sm++) {
        dp[crr][j][sm] = 0;
        if (j == 0 && sm == 0)
          dp[crr][j][sm] = 1;
        else if (sm > j)
          dp[crr][j][sm] = 0;
        else if (i == 0) {
          dp[crr][j][sm] = (a[i] == j && (a[i] == sm || sm == 0));
        } else {
          if (a[i] <= min(sm, j))
            dp[crr][j][sm] = dp[prev][j - a[i]][sm - a[i]];
          if (a[i] <= j) maxs(dp[crr][j][sm], dp[prev][j - a[i]][sm]);
          maxs(dp[crr][j][sm], dp[prev][j][sm]);
        }
      }
    }
    crr = 1 - crr;
    prev = 1 - prev;
  }
  vector<int> ans;
  for (int sm = (0); sm < (k + 1); sm++) {
    if (dp[prev][k][sm]) ans.push_back(sm);
  }
  cout << int((ans).size()) << '\n';
  for (auto e : (ans)) {
    cout << e << ' ';
  }
  cout << '\n';
  return 0;
}
