#include <bits/stdc++.h>
using namespace std;
const int N = 555;
int n, k;
bool dp[N][N];
int a[N];
bool res[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < (n); i++) cin >> a[i];
  dp[0][0] = true;
  for (int i = 0; i < (n); i++) {
    for (int sum = (k + 1 - a[i]) - 1; sum >= (0); sum--)
      for (int as = 0; as < (sum + 1); as++) {
        int bs = sum - as;
        dp[as + a[i]][bs] = dp[as + a[i]][bs] || dp[as][bs];
        dp[as][bs + a[i]] = dp[as][bs + a[i]] || dp[as][bs];
      }
  }
  vector<int> rv;
  for (int i = 0; i < (k + 1); i++)
    if (dp[i][k - i]) rv.push_back(i);
  cout << rv.size() << endl;
  for (auto x : rv) cout << x << " ";
  cout << endl;
  return 0;
}
