#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1005;
int a[505];
bool dp[505][505];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  memset(dp, false, sizeof(dp));
  dp[0][0] = true;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = k; j >= 0; j--) {
      for (int t = j; t >= 0; t--) {
        dp[j][t] = dp[j][t] | dp[j][t];
        if (j >= a[i]) {
          dp[j][t] = dp[j][t] | dp[j - a[i]][t];
          if (t >= a[i]) dp[j][t] = dp[j][t] | dp[j - a[i]][t - a[i]];
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; i++) {
    if (dp[k][i]) ans.push_back(i);
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i]);
  return 0;
}
