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