#include <bits/stdc++.h>
using namespace std;
bitset<505> dp[505];
int v[505];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", v + i);
  dp[0][0] = true;
  for (int i = 0; i < n; i++)
    for (int j = k; j >= v[i]; j--)
      dp[j] |= (dp[j - v[i]] << v[i]) | dp[j - v[i]];
  vector<int> ans;
  for (int i = 0; i <= k; i++)
    if (dp[k][i]) ans.push_back(i);
  printf("%d\n", (int)ans.size());
  for (int i : ans) printf("%d ", i);
  return 0;
}
