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