#include <bits/stdc++.h>
using namespace std;
long long dp[2][505][505], n, k, a[505];
int main(int argc, char const *argv[]) {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  dp[1][0][0] = 1;
  for (int i = 0; i < n; ++i) {
    long long f = (i & 1);
    for (int j = 0; j <= k; ++j) {
      for (int l = 0; l <= k; ++l) {
        dp[f][j][l] = dp[1 - f][j][l];
      }
    }
    for (int j = 0; j + a[i] <= k; ++j) {
      for (int l = 0; l <= j + a[i]; ++l) {
        if (dp[1 - f][j][l]) {
          dp[f][j + a[i]][l] = 1;
          dp[f][j + a[i]][l + a[i]] = 1;
          dp[f][j + a[i]][j + a[i]] = 1;
        }
      }
    }
  }
  vector<long long> ans;
  for (int i = 0; i <= k; ++i) {
    if (dp[(n - 1) & 1][k][i]) ans.push_back(i);
  }
  cout << ans.size() << '\n';
  for (long long num : ans) cout << num << ' ';
  return 0;
}
