#include <bits/stdc++.h>
using namespace std;
int a[510];
bool dp[510][510][510];
int main(int argc, const char* argv[]) {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0][0] = 1;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int kk = 0; kk <= k; kk++) {
        if (dp[i][j][kk] == 1) {
          dp[i + 1][j][kk] = 1;
          if (j + a[i + 1] <= k) {
            dp[i + 1][j + a[i + 1]][kk] = 1;
          }
        }
        if (dp[i][j][kk] == 1 && a[i + 1] + max(kk, j) <= k) {
          dp[i + 1][j + a[i + 1]][kk + a[i + 1]] = 1;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= k; i++) {
    if (dp[n][k][i] == 1) {
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 0; i <= k; i++) {
    if (dp[n][k][i] == 1) {
      cout << i << " ";
    }
  }
  return 0;
}
