#include <bits/stdc++.h>
using namespace std;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
void we_r_done() {
  cout << "NO";
  exit(0);
}
void debug(string mssg) {
  cout << mssg;
  exit(0);
}
using bs = bitset<503>;
bool dp[2][502][502];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int cur = i % 2;
    int prev = cur ^ 1;
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= j; l++) {
        dp[cur][j][l] = dp[prev][j][l];
        if (a[i] <= j) {
          dp[cur][j][l] |= dp[prev][j - a[i]][l];
          if (a[i] <= l) dp[cur][j][l] |= dp[prev][j - a[i]][l - a[i]];
        }
      }
    }
  }
  vector<int> v;
  for (int i = 0; i <= k; i++) {
    if (dp[n % 2][k][i]) v.push_back(i);
  }
  cout << v.size() << endl;
  for (int i : v) printf("%d ", i);
  return 0;
}
