#include <bits/stdc++.h>
using namespace std;
constexpr long long N = 5e2 + 7, oo = 1e9 + 7, OO = 1e18 + 7;
int n, k, a[N];
vector<int> ans;
bool dp[N][N][N];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0][0][0] = true;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int l = j; l <= k; l++) {
        dp[i][j][l] = dp[i - 1][j][l];
        if (a[i - 1] <= j) {
          dp[i][j][l] |= dp[i - 1][j - a[i - 1]][l - a[i - 1]];
        }
        if (a[i - 1] <= l) {
          dp[i][j][l] |= dp[i - 1][j][l - a[i - 1]];
        }
      }
    }
  }
  for (int i = 0; i <= k; i++)
    if (dp[n][i][k]) ans.push_back(i);
  cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
