#include <bits/stdc++.h>
using namespace std;
bool dp[510][510][510];
int a[520];
int main() {
  int n, K;
  cin >> n >> K;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= K; j++) {
      for (int k = 0; k <= K; k++) {
        if (dp[i][j][k]) {
          dp[i + 1][j][k] = 1;
          if (a[i] + k <= K && j + a[i] <= K) {
            dp[i + 1][j + a[i]][k + a[i]] = 1;
          }
          if (a[i] + k <= K) dp[i + 1][j][k + a[i]] = 1;
        }
      }
    }
  }
  vector<int> res;
  for (int i = 0; i <= K; i++) {
    if (dp[n][i][K]) res.push_back(i);
  }
  int sz = res.size();
  cout << sz << endl;
  sort(res.begin(), res.end());
  for (int i = 0; i < sz; i++) {
    cout << res[i] << " ";
  }
  cout << endl;
  return 0;
}
