#include <bits/stdc++.h>
using namespace std;
const int maxn = 510;
int c[maxn];
bool dp[maxn][maxn][maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> c[i];
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= j; l++) {
        dp[i][j][l] = dp[i - 1][j][l];
        if (c[i] <= j) {
          dp[i][j][l] |= dp[i - 1][j - c[i]][l];
          if (c[i] <= l) {
            dp[i][j][l] |= dp[i - 1][j - c[i]][l - c[i]];
          }
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; i++) {
    if (dp[n][k][i]) ans.push_back(i);
  }
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
