#include <bits/stdc++.h>
using namespace std;
int dp[505][505];
vector<int> ans;
int main() {
  int n, K;
  scanf("%d %d", &n, &K);
  ans.clear();
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    int m;
    scanf("%d", &m);
    for (int j = K; j >= m; --j) {
      for (int k = 0; k + m <= K; ++k) {
        if (dp[j - m][k]) dp[j][k] = dp[j][k + m] = 1;
      }
    }
  }
  for (int i = 0; i <= K; ++i) {
    if (dp[K][i]) ans.push_back(i);
  }
  sort(ans.begin(), ans.end());
  int len = ans.size();
  printf("%d\n", len);
  for (int i = 0; i < len; ++i) {
    if (i) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
