#include <bits/stdc++.h>
const int INF_INT = 0x3f3f3f3f;
const long long INF_LL = 0x7f7f7f7f;
const int MOD = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1);
using namespace std;
int n, k;
int c[550];
int dp[2][555][555];
int main(int argc, char const *argv[]) {
  while (scanf("%d%d", &n, &k) == 2) {
    for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 1; i <= n; i++) {
      int now = i % 2;
      int last = now ^ 1;
      for (int j = 0; j <= k; j++) {
        for (int s = 0; s <= j; s++) {
          dp[now][j][s] |= dp[last][j][s];
          if (j >= c[i]) dp[now][j][s] |= dp[last][j - c[i]][s];
          if (s >= c[i]) dp[now][j][s] |= dp[last][j - c[i]][s - c[i]];
        }
      }
    }
    vector<int> ans;
    for (int i = 0; i <= k; i++)
      if (dp[n % 2][k][i]) ans.push_back(i);
    cout << (int)ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
    cout << endl;
  }
  return 0;
}
