#include <bits/stdc++.h>
using namespace std;
const int N = 510;
set<int> s;
int dp[2][N][N];
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  int n, k, a, f, s;
  cin >> n >> k;
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    f = i % 2;
    s = 1 - f;
    for (int j = 0; j <= k; j++) {
      for (int g = 0; g <= j; g++) {
        dp[f][j][g] = dp[s][j][g];
        if (j >= a) {
          dp[f][j][g] |= dp[s][j - a][g];
          if (g >= a) {
            dp[f][j][g] |= dp[s][j - a][g - a];
          }
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; i++) {
    if (dp[n % 2][k][i]) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << endl;
  for (int i : ans) cout << i << " ";
}
