#include <bits/stdc++.h>
using namespace std;
const int N = 501;
int n, k;
int C[N];
bool Dp[N][N][N];
vector<int> Ans;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", C + i);
  Dp[n][0][0] = true;
  for (int idx = n - 1; idx >= 0; idx--)
    for (int Sum = 0; Sum <= k; Sum++)
      for (int X = 0; X <= k; X++) {
        Dp[idx][Sum][X] |= Dp[idx + 1][Sum][X];
        Dp[idx][Sum][X] |= (Sum >= C[idx] && Dp[idx + 1][Sum - C[idx]][X]);
        Dp[idx][Sum][X] |= (Sum >= C[idx] && X >= C[idx] &&
                            Dp[idx + 1][Sum - C[idx]][X - C[idx]]);
      }
  for (int X = 0; X <= k; X++)
    if (Dp[0][k][X]) Ans.push_back(X);
  printf("%d\n", Ans.size());
  for (auto x : Ans) printf("%d ", x);
  puts("");
  return 0;
}
