#include <bits/stdc++.h>
using namespace std;
bool dp[2][502][502];
void func(int n, int *c, int k) {
  int f = 1, g = 0;
  dp[0][0][0] = true;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++)
      for (int y = 0; y <= k; y++)
        dp[f][j][y] =
            dp[g][j][y] || (j - c[i] >= 0 ? dp[g][j - c[i]][y] : false) ||
            ((y - c[i] >= 0 && j - c[i] >= 0) ? dp[g][j - c[i]][y - c[i]]
                                              : false);
    swap(f, g);
  }
  vector<int> v;
  for (int y = 0; y <= k; y++)
    if (dp[g][k][y]) v.push_back(y);
  cout << v.size() << endl;
  for (auto j : v) cout << j << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int c[n + 2];
  for (int i = 1; i <= n; i++) cin >> c[i];
  func(n, c, k);
  return 0;
}
