#include <bits/stdc++.h>
using namespace std;
int a[505];
bitset<505> dp[2][505];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  auto &x = dp[0], &y = dp[1];
  x[0].set(0);
  for (int i = 0; i < n; ++i) {
    swap(x, y);
    for (int j = 0; j <= k; ++j) x[j] = y[j];
    for (int j = a[i]; j <= k; ++j) {
      x[j] |= y[j - a[i]];
      x[j] |= y[j - a[i]] << a[i];
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; ++i) {
    if (x[k].test(i)) ans.push_back(i);
  }
  printf("%d\n", ans.size());
  for (auto x : ans) printf("%d ", x);
  return 0;
}
