#include <bits/stdc++.h>
using namespace std;
const int N = 505;
bool dp[2][N][N];
int main() {
  int n, k, x;
  bool dp[2][N][N];
  cin >> n >> k;
  dp[1][0][0] = true;
  for (int i = 0; i < n; i++) {
    int now = i % 2;
    int last = 1 - now;
    cin >> x;
    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 (x <= y) {
            dp[now][j][y] |= dp[last][j - x][y - x];
          }
        }
      }
    }
  }
  int now = (n - 1) % 2, count = 0;
  for (int i = 0; i < k + 1; i++) {
    if (dp[now][k][i]) count++;
  }
  cout << count << endl;
  for (int i = 0; i < k + 1; i++) {
    if (dp[now][k][i]) cout << i << " ";
  }
}
