#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 7;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
string s;
long long a[505];
bool dp[505][505][505];
long long n, k;
void solve() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0][0][0] = 1;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      for (long long b = 0; b <= j; b++) {
        dp[i + 1][j][b] = dp[i][j][b];
        if (a[i] <= j) dp[i + 1][j][b] |= dp[i][j - a[i]][b];
        if (a[i] <= j && a[i] <= b)
          dp[i + 1][j][b] |= dp[i][j - a[i]][b - a[i]];
      }
    }
  }
  vector<long long> ans;
  for (long long i = 0; i <= k; i++) {
    if (dp[n][k][i]) ans.push_back(i);
  }
  cout << ((long long)(ans).size()) << '\n';
  for (auto x : ans) cout << x << " ";
  cout << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
