#include <bits/stdc++.h>
using namespace std;
int n, kk, a[501];
bool dp[501][501];
vector<int> res;
int main() {
  scanf("%d%d", &n, &kk);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int k = 0; k <= kk; k++) dp[k][0] = true;
  for (int i = 1; i <= n; i++) {
    for (int k = kk - a[i]; k >= 0; k--) {
      if (!dp[k][k]) continue;
      for (int j = 0; j <= k; j++)
        if (dp[k][j]) dp[k + a[i]][j] = true, dp[k + a[i]][j + a[i]] = true;
    }
  }
  for (int i = 0; i <= kk; i++)
    if (dp[kk][i]) res.push_back(i);
  printf("%d\n", res.size());
  for (int x : res) printf("%d ", x);
}
