#include <bits/stdc++.h>
using namespace std;
const int mx = 505;
int dp[2][mx][mx];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> c(n);
  for (int i = 0; i < n; i++) cin >> c[i];
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int now = i % 2, last = 1 - now, x = c[i - 1];
    for (int j = 0; j <= k; j++)
      for (int y = 0; y <= j; y++) {
        dp[now][j][y] = dp[last][j][y];
        if (j >= x) {
          dp[now][j][y] |= dp[last][j - x][y];
          if (y >= x) dp[now][j][y] |= dp[last][j - x][y - x];
        }
      }
  }
  vector<int> ret;
  for (int i = 0; i <= k; i++)
    if (dp[n % 2][k][i]) ret.push_back(i);
  cout << ret.size() << endl;
  for (int x : ret) cout << x << " ";
  cout << endl;
  return 0;
}
