#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e2 + 52;
long long int n, k, a[MAXN];
bool dp[MAXN][MAXN][MAXN];
vector<int> ans;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0][0] = dp[0][a[0]][0] = dp[0][a[0]][a[0]] = true;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= 500; j++) {
      for (int l = 0; l <= 500; l++) {
        dp[i][j][l] = dp[i - 1][j][l];
        if (j >= a[i] && dp[i - 1][j - a[i]][l]) dp[i][j][l] = true;
        if (j >= a[i] && l >= a[i] && dp[i - 1][j - a[i]][l - a[i]])
          dp[i][j][l] = true;
      }
    }
  }
  for (int i = 0; i <= 500; i++)
    if (dp[n - 1][k][i]) ans.push_back(i);
  cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
}
