#include <bits/stdc++.h>
using namespace std;
const int N = 501;
bool dp[N][N][N];
int main() {
  ios_base::sync_with_stdio(0);
  int t, i, j, l;
  int n, k;
  cin >> n >> k;
  int arr[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  dp[0][0][0] = true;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= k; j++) {
      for (l = 0; l <= j; l++) {
        dp[i][j][l] = dp[i - 1][j][l];
        if (j - arr[i] >= 0) dp[i][j][l] |= dp[i - 1][j - arr[i]][l];
        if (j - arr[i] >= 0 && l - arr[i] >= 0)
          dp[i][j][l] |= dp[i - 1][j - arr[i]][l - arr[i]];
      }
    }
  }
  int cnt = 0;
  for (i = 0; i <= k; i++) {
    if (dp[n][k][i]) cnt++;
  }
  cout << cnt << "\n";
  for (i = 0; i <= k; i++) {
    if (dp[n][k][i]) cout << i << " ";
  }
}
