#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 555;
int arr[maxn];
bool ans[maxn][maxn][maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, i, j, k;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> arr[i];
  ans[0][0][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= m; j++) {
      for (k = 0; k <= m; k++) {
        ans[i][j][k] |= ans[i - 1][j][k];
        if (k >= arr[i]) {
          ans[i][j][k] |= ans[i - 1][j][k - arr[i]];
          if (j >= arr[i]) {
            ans[i][j][k] |= ans[i - 1][j - arr[i]][k - arr[i]];
          }
        }
      }
    }
  }
  vector<int> v;
  for (i = 0; i <= m; i++) {
    if (ans[n][i][m]) {
      v.push_back(i);
    }
  }
  cout << int(v.size()) << endl;
  for (i = 0; i < int(v.size()); i++) cout << v[i] << " ";
  return 0;
}
