#include <bits/stdc++.h>
using namespace std;
int n, k, m, dp[505][505];
int process() {
  cin >> n >> k;
  dp[0][0] = 1;
  for (int iT = 1; iT <= n; iT++) {
    cin >> m;
    for (int i = k; i >= m; i--)
      for (int j = 0; j <= k - m; j++)
        if (dp[i - m][j]) dp[i][j] = dp[i][j + m] = 1;
  }
  return 0;
}
int output() {
  int res = 0, f[505];
  for (int i = 0; i <= k; i++)
    if (dp[k][i]) f[++res] = i;
  cout << res << endl;
  for (int i = 1; i <= res; i++) cout << f[i] << " ";
  return 0;
}
int main() {
  process();
  output();
  return 0;
}
