#include <bits/stdc++.h>
using namespace std;
void MAIN();
int main() {
  MAIN();
  return 0;
}
const int N = 512;
bool f[N][N], ok[N];
int n, k, c[N];
void MAIN() {
  scanf("%d %d", &n, &k);
  f[0][0] = true;
  for (int i = 0; i < n; i++) {
    scanf("%d", c + i);
    for (int j = k; j >= 0; j--) {
      for (int l = k - j; l >= 0; l--)
        if (f[j][l]) {
          if (j + l + c[i] <= k) {
            f[j + c[i]][l] = true;
            f[j][l + c[i]] = true;
          }
        }
    }
  }
  for (int i = 0; i <= k; i++)
    if (f[i][k - i]) ok[i] = true;
  vector<int> ans;
  for (int i = 0; i <= k; i++)
    if (ok[i]) ans.push_back(i);
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < ans.size(); i++)
    printf("%d%c", ans[i], " \n"[i + 1 == ans.size()]);
}
