#include <bits/stdc++.h>
using namespace std;
int main() {
  bool dp[2][505][505];
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  dp[0][0][0] = 1;
  for (int i = 1; i < n + 1; i++) {
    int now = i % 2;
    int last = 1 - now;
    int x;
    scanf("%d", &x);
    for (int j = 0; j <= k; j++) {
      for (int y = 0; y <= j; y++) {
        dp[now][j][y] = dp[last][j][y];
        if (j >= x) {
          dp[now][j][y] |= dp[last][j - x][y];
          if (y >= x) dp[now][j][y] |= dp[last][j - x][y - x];
        }
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i < k + 1; i++) {
    if (dp[n % 2][k][i]) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << endl;
  for (int x = 0; x < ans.size(); x++) {
    cout << ans[x] << " ";
  }
  cout << endl;
  return 0;
}
