#include <bits/stdc++.h>
using namespace std;
inline int64_t max(int64_t a, int64_t b) { return (a > b) ? a : b; }
inline int64_t min(int64_t a, int64_t b) { return (a < b) ? a : b; }
inline int64_t max3(int64_t a, int64_t b, int64_t c) {
  return max(a, max(b, c));
}
inline int64_t min3(int64_t a, int64_t b, int64_t c) {
  return min(a, min(b, c));
}
int64_t gcd(int64_t a, int64_t b) { return (a % b == 0) ? b : gcd(b, a % b); }
int64_t pow3(int64_t a, int64_t b, int64_t m = 1000000007) {
  int64_t res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return res;
}
bool dp[2][501][501];
void solve() {
  int64_t n, k;
  cin >> n >> k;
  int64_t a[n];
  for (int64_t i = 0; i < n; i++) cin >> a[i];
  for (int64_t i = 0; i < 2; i++)
    for (int64_t j = 0; j < 501; j++)
      for (int64_t x = 0; x < 501; x++) dp[i][j][x] = false;
  dp[0][0][0] = true;
  for (int64_t i = 0; i < n; i++) {
    int p = i % 2, lp = 1 - p;
    for (int64_t j = 0; j < k + 1; j++)
      for (int64_t x = 0; x < j + 1; x++) {
        dp[lp][j][x] = dp[p][j][x];
        if (j >= a[i]) dp[lp][j][x] |= dp[p][j - a[i]][x];
        if (x >= a[i]) dp[lp][j][x] |= dp[p][j - a[i]][x - a[i]];
      }
  }
  vector<int64_t> ans;
  for (int64_t i = 0; i < k + 1; i++)
    if (dp[n % 2][k][i]) ans.push_back(i);
  cout << ans.size() << endl;
  for (auto i : ans) cout << i << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  while (q--) {
    solve();
  }
  return 0;
}
