#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int maxn = 500 + 5;
int dp[maxn][maxn], ans[maxn], c[maxn];
int main() {
  int n, sum;
  memset(dp, 0, sizeof(dp));
  scanf("%d%d", &n, &sum);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
  }
  sort(c + 1, c + n + 1);
  for (int k = 1; k <= n; k++) {
    for (int i = 500; i >= 1; i--) {
      if (i - c[k] >= 0 && dp[i - c[k]][i - c[k]]) {
        for (int j = 500; j >= 0; j--) {
          if (j >= c[k]) dp[i][j] |= dp[i - c[k]][j - c[k]];
        }
        for (int j = 500; j >= 0; j--) {
          if (dp[i - c[k]][j]) dp[i][j] = 1;
        }
      }
    }
    dp[c[k]][0] = 1;
    dp[c[k]][c[k]] = 1;
  }
  int cnt = 0;
  for (int i = 0; i <= 500; i++) {
    if (dp[sum][i]) {
      ans[i] = 1;
      ++cnt;
    }
  }
  printf("%d\n", cnt);
  for (int i = 0; i <= 500; i++) {
    if (ans[i]) printf("%d ", i);
  }
  printf("\n");
  return 0;
}
