#include <bits/stdc++.h>
using namespace std;
bool dp[501][501][501];
int c[500];
int main() {
  int n, k;
  dp[0][0][0] = 1;
  cin >> n >> k;
  int s = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  sort(c, c + n);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= k; l++) {
        dp[i][j][l] |= dp[i - 1][j][l];
        if (j >= c[i - 1]) {
          dp[i][j][l] |= dp[i - 1][j - c[i - 1]][l];
          if (l >= c[i - 1])
            dp[i][j][l] |= dp[i - 1][j - c[i - 1]][l - c[i - 1]];
        }
        if (i == n && j == k) s += dp[i][j][l];
      }
    }
  }
  cout << s << endl;
  for (int i = 0; i <= k; i++) {
    if (dp[n][k][i]) cout << i << " ";
  }
}
