#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[501];
bool ans[501];
bool dp[501][501];
bool r[501][501];
bitset<501> bs[501][501];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = true;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = dp[i - 1][j] || (j - a[i] >= 0 ? dp[i - 1][j - a[i]] : false);
    }
  }
  if (dp[n][k]) {
    r[n][k] = true;
    r[0][0] = true;
  } else {
    cout << 0 << endl;
    return 0;
  }
  for (int i = n; i > 0; i--)
    for (int j = k; j >= 0; j--)
      if (r[i][j]) {
        if (dp[i - 1][j]) r[i - 1][j] = true;
        if (j - a[i] >= 0 && dp[i - 1][j - a[i]]) r[i - 1][j - a[i]] = true;
      }
  bs[0][0].set(0, 1);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= k; j++)
      if (r[i][j]) {
        if (j - a[i] >= 0 && r[i - 1][j - a[i]])
          bs[i][j] = bs[i - 1][j - a[i]] | (bs[i - 1][j - a[i]] << a[i]);
        if (r[i - 1][j]) bs[i][j] |= bs[i - 1][j];
      }
  cout << bs[n][k].count() << endl;
  for (int i = 0; i <= k; i++)
    if (bs[n][k].test(i)) cout << i << " ";
  cout << endl;
  return 0;
}
