#include <bits/stdc++.h>
using namespace std;
int a[500 + 10];
bool DP[2][500 + 10][500 + 10];
int ans[1000000 + 10];
int DP2[100000 + 10];
bool DP3[500 + 10][500 + 10];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  DP[0][0][0] = 1;
  DP2[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (DP2[j] <= i && DP2[j] != 0 && DP2[j + a[i]] == 0) {
        DP2[j + a[i]] = i + 1;
      }
    }
    for (int m = 0; m <= k; m++) {
      if (DP2[m] == i + 1) {
        for (int l = i; l <= n; l++) {
          DP3[l][m] = 1;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (DP3[i][j] == 1) {
        DP[i % 2][j][0] = 1;
      }
      for (int l = 0; l <= k; l++) {
        if (j - a[i] >= 0) {
          if (DP[1 - (i % 2)][j - a[i]][l] == 1) {
            DP[i % 2][j][l + a[i]] = 1;
            DP[i % 2][j][l] = 1;
          }
        }
        if (DP[1 - (i % 2)][j][l] == 1) {
          DP[i % 2][j][l] = 1;
        }
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i <= k; i++) {
    if (DP[n % 2][k][i] == 1) {
      ans[cnt++] = i;
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    cout << ans[i] << " ";
  }
}
