#include <bits/stdc++.h>
using namespace std;
const long long maxn = 4e6 + 5;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
bitset<505> dp[505], fuck(156);
long long a[maxn];
long long n, k;
long long ans[maxn];
long long tot = 0;
signed main() {
  n = read(), k = read();
  for (register long long i = 1; i <= n; i++) a[i] = read();
  dp[0][0] = 1;
  for (register long long i = 1; i <= n; i++) {
    for (register long long j = k; j >= a[i]; j--) {
      dp[j] = dp[j] | ((dp[j - a[i]] << a[i]) | dp[j - a[i]]);
    }
  }
  for (register long long i = 0; i <= k; i++) {
    if (dp[k][i]) ans[++tot] = i;
  }
  printf("%lld\n", tot);
  for (register long long i = 1; i <= tot; i++) {
    printf("%lld ", ans[i]);
  }
  printf("\n");
  return 0;
}
