#include <bits/stdc++.h>
using namespace std;
const int maxn = 507;
int n, k, c[maxn], dp[maxn][maxn], q;
void solve() {
  cin >> n >> k;
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    for (int j = k - c[i]; j >= 0; --j) {
      for (int l = k; l >= 0; --l) {
        if (dp[j][l]) {
          dp[j + c[i]][l] = 1;
          if (l <= k - c[i]) {
            dp[j + c[i]][l + c[i]] = 1;
          }
        }
      }
    }
  }
  for (int i = 0; i <= k; ++i) {
    if (dp[k][i]) {
      q++;
    }
  }
  cout << q << '\n';
  for (int i = 0; i <= k; ++i) {
    if (dp[k][i]) {
      cout << i << ' ';
    }
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
