#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3 + 10;
int d[maxn][maxn], c[maxn], n, k;
vector<int> ans;
int main() {
  scanf("%d%d", &n, &k);
  memset(d, 0, sizeof(d));
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
  }
  d[0][0] = 1;
  for (int l = 1; l <= n; l++) {
    d[c[l]][0] = 1;
    d[c[l]][c[l]] = 1;
    for (int i = k; i >= 0; i--) {
      for (int j = k; j >= 0; j--) {
        if (d[i][j]) {
          d[i + c[l + 1]][j] = 1;
          d[i + c[l + 1]][j + c[l + 1]] = 1;
        }
      }
    }
  }
  for (int i = 0; i <= k; i++) {
    if (d[k][i]) {
      ans.push_back(i);
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) {
    printf("%d", ans[i]);
    if (i == ans.size() - 1)
      printf("\n");
    else
      printf(" ");
  }
}
