#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mxn = 510;
int n, m, k;
int f[mxn][mxn];
int a[mxn];
int ans = 0;
int inf = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n >> k;
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (int j = k; j >= a[i]; j--) {
      for (int x = j; x >= 0; x--) {
        f[j][x] |= f[j - a[i]][x];
        if (x >= a[i]) f[j][x] |= f[j - a[i]][x - a[i]];
      }
    }
  }
  for (int i = 0; i <= k; i++) ans += f[k][i];
  cout << ans << endl;
  for (int i = 0; i <= k; i++) {
    if (f[k][i]) cout << i << ' ';
  }
}
