#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 50;
bool dp[2][505][505];
int a[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  dp[0][0][0] = true;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= k; l++) {
        if (i % 2 == 1) {
          dp[1][j][l] = dp[0][j][l];
          if (j - a[i] >= 0) {
            dp[1][j][l] = dp[0][j - a[i]][l] | dp[1][j][l];
            if (l - a[i] >= 0) {
              dp[1][j][l] = dp[0][j - a[i]][l - a[i]] | dp[1][j][l];
            }
          }
        } else {
          dp[0][j][l] = dp[1][j][l];
          if (j - a[i] >= 0) {
            dp[0][j][l] = dp[1][j - a[i]][l] | dp[0][j][l];
            if (l - a[i] >= 0) {
              dp[0][j][l] = dp[1][j - a[i]][l - a[i]] | dp[0][j][l];
            }
          }
        }
      }
    }
  }
  int ans = 0;
  n = n % 2;
  for (int i = 0; i <= k; i++) {
    if (dp[n][k][i]) ans++;
  }
  cout << ans << endl;
  for (int i = 0; i <= k; i++) {
    if (dp[n][k][i]) cout << i << " ";
  }
}
