#include <bits/stdc++.h>
using namespace std;
int n, m, a, k, dp[505][505];
vector<int> v;
int main() {
  scanf("%d%d", &n, &k);
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    for (int j = 500; j >= 0; j--) {
      for (int k = j; k >= 0; k--) {
        if (j >= a) dp[j][k] |= dp[j - a][k];
        if (k >= a) dp[j][k] |= dp[j - a][k - a];
      }
    }
  }
  for (int i = 0; i <= k; i++) {
    if (dp[k][i]) {
      v.push_back(i);
    }
  }
  printf("%d\n", v.size());
  for (int i = 0; i < v.size(); i++) {
    printf("%d ", v[i]);
  }
  printf("\n");
}
