#include <bits/stdc++.h>
using namespace std;
bool dp[505][505][505];
long long n, a[505];
void f(long long i, long long num, long long tot) {
  if (num > 500 || dp[i][num][tot]) return;
  dp[i][num][tot] = 1;
  if (i == n) return;
  f(i + 1, num, tot);
  f(i + 1, num + a[i], tot);
  f(i + 1, num + a[i], tot + a[i]);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long k;
  cin >> n >> k;
  long long i = 0;
  while (i < n) cin >> a[i++];
  f(0, 0, 0);
  i = 0;
  vector<long long> ans;
  while (i <= k) {
    if (dp[n][k][i]) ans.push_back(i);
    i++;
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x << " ";
}
