#include <bits/stdc++.h>
using namespace std;
int arr[501];
int n;
int k;
bool vis[501][501][501];
bool anw[501][501][501];
bool dp(int id, int sb, int sum) {
  if (id == n) {
    if (sum == k) return anw[id][sb][sum] = 1;
    return anw[id][sb][sum] = 0;
  }
  if (vis[id][sb][sum]) return anw[id][sb][sum];
  vis[id][sb][sum] = 1;
  bool ws = 0;
  ws |= dp(id + 1, sb, sum);
  if (arr[id] + sum <= k) {
    ws |= dp(id + 1, sb + arr[id], sum + arr[id]);
    ws |= dp(id + 1, sb, sum + arr[id]);
  }
  return anw[id][sb][sum] = ws;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  dp(0, 0, 0);
  vector<int> tp;
  for (int i = 0; i < 501; i++) {
    if (anw[n][i][k]) tp.push_back(i);
  }
  printf("%d\n", int(tp.size()));
  for (int i = 0; i < tp.size(); i++) {
    if (i != 0) printf(" ");
    printf("%d", tp[i]);
  }
  printf("\n");
}
