#include <bits/stdc++.h>
using namespace std;
char dp[505][505][505];
int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  vector<int> c(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  for (int i = 0; i <= n; ++i) {
    dp[i][0][0] = true;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      for (int q = 0; q <= j; ++q) {
        dp[i][j][q] = dp[i - 1][j][q];
        if (j >= c[i - 1]) {
          if (j - c[i - 1] >= q) {
            dp[i][j][q] |= dp[i - 1][j - c[i - 1]][q];
          }
          if (q >= c[i - 1]) {
            dp[i][j][q] |= dp[i - 1][j - c[i - 1]][q - c[i - 1]];
          }
        }
        if (i == n && j == k) {
          ans += dp[i][j][q];
        }
      }
    }
  }
  cout << ans << endl;
  for (int i = 0; i <= k; ++i) {
    if (dp[n][k][i]) cout << i << " ";
  }
  cout << endl;
  return 0;
}
