#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, k;
bool mem[N][N][N];
int c[N];
bool ok[N];
void go(int i, int sumX, int sum) {
  if (sumX == k) {
    ok[sum] = 1;
    return;
  }
  if (sumX > k) {
    return;
  }
  if (i == n) return;
  if (mem[i][sumX][sum]) return;
  mem[i][sumX][sum] = 1;
  go(i + 1, sumX, sum);
  go(i + 1, sumX + c[i], sum + c[i]);
  go(i + 1, sumX + c[i], sum);
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> c[i];
  go(0, 0, 0);
  int ans = 0;
  for (int i = 0; i <= k; i++)
    if (ok[i]) ans++;
  cout << ans << endl;
  for (int i = 0; i <= k; i++)
    if (ok[i]) cout << i << " ";
  cout << endl;
  return 0;
}
