#include <bits/stdc++.h>
using namespace std;
int fpow(int a, int b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    int pom = fpow(a, b / 2);
    return (pom * pom) % 1000000007;
  }
  if (b % 2 == 1) {
    return (a * fpow(a, b - 1)) % 1000000007;
  }
}
int rev(int a, int b) { return (a * fpow(b, 1000000007 - 2)) % 1000000007; }
int exgcd(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int d = exgcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
string s, ss;
bool dp[2][507][507];
int tab[507];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= (n); ++i) {
    cin >> tab[i];
  }
  dp[1][0][0] = 1;
  dp[0][0][0] = 1;
  int ans = 0;
  for (int i = 1; i <= (n); ++i) {
    for (int j = 0; j <= (k); ++j) {
      for (int l = 0; l <= (k); ++l) {
        if (dp[(i - 1) % 2][j][l]) {
          dp[i % 2][j][l] = true;
        }
        if (j - tab[i] >= 0) {
          if (dp[(i - 1) % 2][j - tab[i]][l]) dp[i % 2][j][l] = true;
          if (l - tab[i] >= 0)
            if (dp[(i - 1) % 2][j - tab[i]][l - tab[i]]) dp[i % 2][j][l] = true;
        }
      }
    }
  }
  for (int i = 0; i <= (k); ++i)
    if (dp[n % 2][k][i]) ans++;
  cout << ans << '\n';
  for (int i = 0; i <= (k); ++i)
    if (dp[n % 2][k][i]) cout << i << " ";
  return 0;
}
