#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long b, long long p) {
  if (p == 0) return 1;
  long long my = bigmod(b, p / 2);
  my *= my;
  my %= 1000000009;
  if (p & 1) my *= b, my %= 1000000009;
  return my;
}
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
bool dp[505][505][505];
bool visit[505][505][505];
int n, k, ara[505];
bool F(int pos, int sum, int tot) {
  if (pos > n) {
    if (tot == 0 && sum == 0)
      return 1;
    else
      return 0;
  }
  if (visit[pos][sum][tot]) return dp[pos][sum][tot];
  bool ret = 0;
  ret = F(pos + 1, sum, tot);
  if (tot - ara[pos] >= 0) ret |= F(pos + 1, sum, tot - ara[pos]);
  if (tot - ara[pos] >= 0 && sum - ara[pos] >= 0)
    ret |= F(pos + 1, sum - ara[pos], tot - ara[pos]);
  visit[pos][sum][tot] = 1;
  return dp[pos][sum][tot] = ret;
}
vector<int> v;
int main() {
  int i;
  scanf("%d %d", &n, &k);
  for (i = 1; i <= n; i++) scanf("%d", &ara[i]);
  for (i = 1; i <= k; i++) {
    bool ret = F(1, i, k);
    if (ret) v.push_back(i);
  }
  int len = v.size();
  printf("%d\n", len + 1);
  printf("0");
  for (i = 0; i < len; i++) printf(" %d", v[i]);
  printf("\n");
  return 0;
}
