#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> c(n + 1, 0);
  c[0] = 0;
  for (int i = 1; i <= n; i++) cin >> c[i];
  sort(c.begin(), c.end());
  bool dp[n + 1][k + 1][k + 1];
  memset(dp, 0, sizeof dp);
  for (int i = 0; i <= n; i++) {
    dp[i][0][0] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int t = j; t <= k; t++) {
        if (c[i] > j && c[i] > t) dp[i][j][t] = dp[i - 1][j][t];
        if (c[i] > j && c[i] <= t)
          dp[i][j][t] = dp[i - 1][j][t - c[i]] || dp[i - 1][j][t];
        if (c[i] <= j && c[i] <= t)
          dp[i][j][t] = dp[i - 1][j - c[i]][t - c[i]] || dp[i - 1][j][t] ||
                        dp[i - 1][j][t - c[i]];
      }
    }
  }
  set<int> ans;
  ans.insert(0);
  for (int i = 0; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (dp[i][j][k] == 1) ans.insert(j);
    }
  }
  cout << ans.size() << endl;
  for (set<int>::iterator it = ans.begin(); it != ans.end(); ++it)
    cout << *it << " ";
}
