#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int dp[2][N][N], v[N];
int n, k, t;
void rev(int i) {
  if (i == 0)
    printf("%d\n%d", t + 1, i);
  else {
    if (dp[n & 1][k][i]) t++;
    rev(i - 1);
    if (dp[n & 1][k][i]) printf(" %d", i);
    if (i == k) puts("");
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", v + i);
  dp[0][0][0] = true;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= k; ++j)
      for (int l = 0; l <= j; ++l) {
        dp[i & 1][j][l] |= dp[(i & 1) ^ 1][j][l];
        if (j >= v[i]) dp[i & 1][j][l] |= dp[(i & 1) ^ 1][j - v[i]][l];
        if (j >= v[i] and l >= v[i])
          dp[i & 1][j][l] |= dp[(i & 1) ^ 1][j - v[i]][l - v[i]];
      }
  rev(k);
  return 0;
}
