#include <bits/stdc++.h>
const long long INF = 4e18L + 1;
const int IINF = 2e9 + 1;
const int limit = 1048576;
using namespace std;
int n, k;
vector<vector<bool> > dp;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  dp.resize(k + 1, vector<bool>(k + 1, false));
  dp[0][0] = true;
  for (long long _ = (long long)0; _ < (long long)n; _++) {
    int c;
    cin >> c;
    for (int i = k; i >= 0; i--) {
      for (int j = k; j >= i; j--) {
        if ((i >= c and dp[i - c][j - c]) or (j >= c and dp[i][j - c])) {
          dp[i][j] = true;
        }
      }
    }
  }
  vector<int> ans;
  for (long long i = (long long)0; i < (long long)k + 1; i++) {
    if (dp[i][k]) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << "\n";
  for (auto& i : ans) {
    cout << i << " ";
  }
  cout << "\n";
  return 0;
}
