#include <bits/stdc++.h>
using namespace std;
int n, k, i, j, x;
bool dp[5001][5001];
int main() {
  dp[0][0] = 1;
  scanf("%d%d", &n, &k);
  while (n--) {
    scanf("%d", &x);
    for (i = 500; i >= 0; i--)
      for (j = 500; j >= 0; j--)
        if (dp[i][j]) dp[i + x][j] = dp[i][j + x] = 1;
  }
  x = 0;
  for (i = 0; i <= k; i++) x += dp[i][k - i];
  printf("%d\n", x);
  for (i = 0; i <= k; i++)
    if (dp[i][k - i]) printf("%d ", i);
}
