#include <bits/stdc++.h>
using namespace std;
bool dp1[505][505], dp2[505][505];
long long pre[500000];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long a[n + 1];
  long long is = 0;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    if (x <= k) a[++is] = x;
  }
  n = is;
  set<long long> s;
  long long id = 0;
  while (true) {
    random_shuffle(a + 1, a + n + 1);
    memset(dp1, 0, sizeof(dp1));
    memset(dp2, 0, sizeof(dp2));
    dp1[0][0] = 1;
    dp2[n + 1][0] = 1;
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= k; j++) {
        if (j >= a[i] && dp1[i - 1][j - a[i]]) dp1[i][j] = 1;
        if (dp1[i - 1][j]) dp1[i][j] = 1;
      }
    }
    for (long long i = n; i >= 1; i--) {
      for (long long j = 1; j <= k; j++) {
        if (j >= a[i] && dp2[i + 1][j - a[i]]) dp2[i][j] = 1;
        if (dp2[i + 1][j]) dp2[i][j] = 1;
      }
    }
    bool visit[505] = {0};
    for (long long i = 1; i <= n + 1; i++) {
      for (long long j = 0; j <= k; j++) {
        if (dp1[i - 1][j] && dp2[i][k - j]) visit[j] = 1, visit[k - j] = 1;
      }
    }
    for (long long i = 0; i <= k; i++) {
      if (visit[i]) s.insert(i);
    }
    pre[id] = s.size();
    if (id > 1200 && pre[id] == pre[id - 1200]) break;
    id++;
  }
  cout << s.size() << "\n";
  for (auto i : s) cout << i << " ";
}
