#include <bits/stdc++.h>
using namespace std;
const int tam = 100010;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1);
bool dp[2][510][510];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int x, now, last;
  for (int i = 1; i < n + 1; i++) {
    now = i % 2;
    cin >> x;
    last = abs(now - 1);
    dp[last][0][0] = 1;
    for (int j = 0; j < 501; j++) {
      for (int k = 0; k < j + 1; k++) {
        dp[now][j][k] = dp[last][j][k];
        if (x <= j) {
          dp[now][j][k] |= dp[last][j - x][k];
          if (x <= k) dp[now][j][k] |= dp[last][j - x][k - x];
        }
      }
    }
  }
  vector<int> res;
  for (int i = 0; i < k + 1; i++)
    if (dp[n % 2][k][i]) res.push_back(i);
  cout << res.size() << '\n';
  for (auto a : res) cout << a << ' ';
  return 0;
}
