#include <bits/stdc++.h>
using namespace std;
bool ans[501];
short ssz[501];
vector<short> v;
int dp[3][501][501];
int n, k;
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cin >> n >> k;
  dp[0][0][0] = true;
  for (int a = 1; a <= n; a++) {
    int idx = a % 2;
    cin >> ssz[a];
    for (int b = k; b >= 0; b--) {
      for (int c = b; c >= 0; c--) {
        if (b >= ssz[a]) dp[idx][b][c] |= dp[idx ^ 1][b - ssz[a]][c];
        if (c >= ssz[a]) dp[idx][b][c] |= dp[idx ^ 1][b - ssz[a]][c - ssz[a]];
        dp[idx][b][c] |= dp[idx ^ 1][b][c];
      }
    }
  }
  int tot = 0;
  for (int a = 0; a <= k; a++)
    if (dp[n % 2][k][a]) tot++;
  printf("%d\n", tot);
  bool ff = true;
  for (int a = 0; a <= k; a++) {
    if (dp[n % 2][k][a] == false) continue;
    if (!ff) printf(" ");
    ff = false;
    printf("%d", a);
  }
  printf("\n");
}
