#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int a[N], n, k;
bool dp[2][N][N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int cur = 1;
  dp[1][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    cur ^= 1;
    for (int j = 0; j <= k; j++) {
      for (int p = 0; p <= j; p++) {
        dp[cur][j][p] |= dp[cur ^ 1][j][p];
        if (j - a[i] >= 0) {
          dp[cur][j][p] |= dp[cur ^ 1][j - a[i]][p];
          if (p - a[i] >= 0) dp[cur][j][p] |= dp[cur ^ 1][j - a[i]][p - a[i]];
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; i++) {
    if (dp[cur][k][i]) ans.push_back(i);
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
