#include <bits/stdc++.h>
using namespace std;
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
const long long int MAXN = 501;
bool dp[MAXN][MAXN][MAXN], done[MAXN][MAXN][MAXN];
long long int n, k;
long long int coins[MAXN];
bool recursion(long long int idx, long long int sum1, long long int sum2) {
  if (sum1 < 0 || sum2 < 0) return false;
  if (idx == 0) {
    if (sum1 || sum2) return false;
    return true;
  }
  if (done[idx][sum1][sum2]) return dp[idx][sum1][sum2];
  done[idx][sum1][sum2] = true;
  bool ans = (recursion(idx - 1, sum1, sum2) |
              recursion(idx - 1, sum1 - coins[idx], sum2) |
              recursion(idx - 1, sum1, sum2 - coins[idx]));
  return dp[idx][sum1][sum2] = ans;
}
void solve() {
  cin >> n >> k;
  for (int i = (1); i <= (n); ++i) cin >> coins[i];
  long long int ans = 0;
  for (int i = (0); i <= (k); ++i)
    if (recursion(n, i, k - i)) ans++;
  cout << ans << endl;
  for (int i = (0); i <= (k); ++i)
    if (recursion(n, i, k - i)) cout << i << " ";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  while (t--) solve();
}
