#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAX = 505;
vector<int> vals[MAX];
bool vals2[MAX][MAX];
int c[MAX];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i + 1]);
  }
  sort(c + 1, c + n + 1);
  vals[0].push_back(0);
  vals2[0][0] = true;
  for (int j = 1; j < n + 1; j++) {
    for (int i = k; i >= 0; i--) {
      for (int l : vals[i]) {
        if (i + c[j] >= MAX) {
          continue;
        }
        if (!vals2[i + c[j]][l]) {
          vals[i + c[j]].push_back(l);
          vals2[i + c[j]][l] = true;
        }
        if (!vals2[i + c[j]][l + c[j]]) {
          vals[i + c[j]].push_back(l + c[j]);
          vals2[i + c[j]][l + c[j]] = true;
        }
      }
    }
  }
  sort(vals[k].begin(), vals[k].end());
  printf("%d\n", vals[k].size());
  for (int i : vals[k]) {
    printf("%d ", i);
  }
  printf("\n");
  ;
}
