#include <bits/stdc++.h>
typedef int LL;
using namespace std;
const int M = 1000000007;
bool dp[2][501][501];
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cout.setf(ios::fixed);
  LL n, i, j, m, k;
  cin >> n >> k;
  for (LL xx = 0; xx < 2; xx++)
    for (i = 0; i < 501; i++)
      for (j = 0; j < 501; j++) dp[xx][i][j] = false;
  vector<LL> v(n);
  for (i = 0; i < n; i++) cin >> v[i];
  LL x = 0;
  LL t;
  dp[0][0][0] = true;
  for (t = 1, x = 0; x < n; x++, t ^= 1)
    for (i = 0; i < 501; i++)
      for (j = 0; j < 501; j++) {
        dp[t][i][j] = false;
        dp[t][i][j] |= dp[t ^ 1][i][j];
        if ((i - v[x]) >= 0) dp[t][i][j] |= dp[t ^ 1][i - v[x]][j];
        if ((j - v[x]) >= 0) dp[t][i][j] |= dp[t ^ 1][i][j - v[x]];
      }
  vector<LL> ans;
  for (i = 0; i <= k; i++) {
    if (dp[t ^ 1][i][k - i]) ans.push_back(i);
  }
  cout << ans.size() << '\n';
  for (i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
  cout << '\n';
}
