#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 9;
const int MOD = 10007;
int mod = 999998639;
long long fact(long long x, long long y) {
  long long ans = 1;
  for (int i = 0; i < y; i++) ans *= x;
  return ans;
}
inline long long qpow(long long b, long long e, long long m = MOD) {
  long long a = 1;
  for (; e; e >>= 1, b = b * b % m)
    if (e & 1) a = a * b % m;
  return a;
}
long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  long long d = exgcd(b, a % b, x, y);
  long long z = x;
  x = y, y = z - y * (a / b);
  return d;
}
int dp[509][509], a[509];
int main() {
  int n, k;
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = k; j >= a[i]; j--) {
        for (int z = 0; z <= k; z++) {
          if (dp[j - a[i]][z]) dp[j][z] = 1;
        }
        for (int z = k; z >= a[i]; z--) {
          if (dp[j - a[i]][z - a[i]]) dp[j][z] = 1;
        }
      }
    }
    int num = 0;
    for (int i = 0; i <= k; i++) {
      if (dp[k][i]) num++;
    }
    printf("%d\n", num);
    for (int i = 0; i <= k; i++) {
      if (dp[k][i]) {
        printf("%d ", i);
      }
    }
    printf("\n");
  }
}
