#include <bits/stdc++.h>
using namespace std;
const int N = 505;
unordered_set<int> dp[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  dp[0].insert(0);
  for (int i = 0; i < n; ++i) {
    int c;
    scanf("%d", &c);
    for (int j = k; j >= c; --j) {
      for (int l : dp[j - c]) dp[j].insert(l);
      for (int l : dp[j - c]) dp[j].insert(l + c);
      if (dp[j].size() > 0) dp[j].insert(j);
    }
  }
  printf("%d\n", dp[k].size());
  vector<int> res;
  for (int l : dp[k]) res.push_back(l);
  sort(res.begin(), res.end());
  for (int l : res) printf("%d ", l);
}
