#include <bits/stdc++.h>
using namespace std;
const int N = 501;
int a[N];
bool dp[2][N][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  clock_t begin = clock();
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= k; ++j)
      for (int t = 0; t <= j; ++t) {
        int now = i % 2;
        int last = 1 - now;
        dp[now][j][t] =
            dp[last][j][t] || (dp[last][j - a[i]][t] && j - a[i] >= 0) ||
            (dp[last][j - a[i]][t - a[i]] && j - a[i] >= 0 && t - a[i] >= 0);
      }
  stack<int> st;
  for (int i = k; i >= 1; --i)
    if (dp[n % 2][k][i]) st.push(i);
  cout << st.size() + 1 << endl << 0 << ' ';
  while (!st.empty()) {
    cout << st.top() << ' ';
    st.pop();
  }
  clock_t end = clock();
  return 0;
}
