#include <bits/stdc++.h>
using namespace std;
using namespace std;
void printVals(vector<int> &a, int s) {
  int n = a.size();
  vector<vector<int> > dp(s + 1, vector<int>(s + 1, 0));
  dp[0][0] = 1;
  for (int i = n - 1; i >= 0; i--) {
    vector<vector<int> > dp_next(s + 1, vector<int>(s + 1));
    for (int s1 = 0; s1 <= s; s1++) {
      for (int s2 = 0; s2 <= s; s2++) {
        dp_next[s1][s2] = dp[s1][s2];
        if (a[i] <= s1) dp_next[s1][s2] |= dp[s1 - a[i]][s2];
        if (a[i] <= s2) dp_next[s1][s2] |= dp[s1][s2 - a[i]];
      }
    }
    dp = dp_next;
  }
  int ct = 0;
  for (int i = 0; i <= s; i++) {
    if (dp[i][s - i]) ct++;
  }
  cout << ct << endl;
  for (int i = 0; i <= s; i++) {
    if (dp[i][s - i]) cout << i << " ";
  }
  cout << endl;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  printVals(a, k);
}
