#include <bits/stdc++.h>
using namespace std;
int n, k, ar[(int)(5e2 + 5)], dp[2][(int)(5e2 + 5)][(int)(5e2 + 5)];
vector<int> ans;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &ar[i]);
  dp[1][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int cur = i % 2;
    int next = (i + 1) % 2;
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= k; l++) {
        dp[next][j][l] = dp[next][j][l] || dp[cur][j][l];
        if (l + ar[i] <= k)
          dp[next][j][l + ar[i]] = dp[next][j][l + ar[i]] || dp[cur][j][l];
        if (j + ar[i] <= k)
          dp[next][j + ar[i]][l] = dp[next][j + ar[i]][l] || dp[cur][j][l];
      }
    }
    for (int j = 0; j <= k; j++)
      for (int l = 0; l <= k; l++) dp[cur][j][l] = 0;
  }
  for (int i = 0; i <= k; i++)
    if (dp[(n + 1) % 2][i][k - i]) ans.push_back(i);
  printf("%d\n", (int)ans.size());
  for (auto i : ans) printf("%d ", i);
}
