#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long fast_exp(long long base, long long exp, long long mod) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % mod;
    base = (base * base) % mod;
    exp /= 2;
  }
  return res;
}
int a[505];
int dp[3][505][505];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  ;
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int now = i % 2;
    int last = 1 - now;
    for (int sum = 0; sum <= k; sum++) {
      for (int sub = 0; sub <= sum; sub++) {
        dp[now][sum][sub] = dp[last][sum][sub];
        if (sum >= a[i]) {
          dp[now][sum][sub] |= dp[last][sum - a[i]][sub];
          if (sub >= a[i])
            dp[now][sum][sub] |= dp[last][sum - a[i]][sub - a[i]];
        }
      }
    }
  }
  set<int> vals;
  for (int i = 0; i <= k; i++)
    if (dp[n % 2][k][i]) vals.insert(i);
  cout << (int)vals.size() << "\n";
  for (auto it = vals.begin(); it != vals.end(); it++) cout << (*it) << " ";
  return 0;
}
