#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 5;
int dp[2][maxn][maxn];
int n, k, c, pre, now;
void DP() {
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c);
    now = i % 2;
    pre = 1 - now;
    for (int j = 0; j <= k; j++)
      for (int r = 0; r <= j; r++) {
        dp[now][j][r] = dp[pre][j][r];
        if (j >= c) dp[now][j][r] |= dp[pre][j - c][r];
        if (r >= c) dp[now][j][r] |= dp[pre][j - c][r - c];
      }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  DP();
  vector<int> ans;
  for (int i = 0; i <= k; i++)
    if (dp[n % 2][k][i]) ans.push_back(i);
  int len = ans.size();
  printf("%d\n%d", len, ans[0]);
  for (int i = 1; i < len; i++) printf(" %d", ans[i]);
  printf("\n");
  return 0;
}
