#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e2 + 5;
int dp[maxn][maxn], c[maxn];
int ans[maxn];
int n, m;
int main(void) {
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
      for (int j = m; j >= c[i]; j--)
        for (int k = 0; k <= j; k++)
          if (dp[j - c[i]][k]) dp[j][k] = dp[j][k + c[i]] = 1;
    int cnt = 0;
    for (int i = 0; i < maxn; i++)
      if (dp[m][i]) ans[cnt++] = i;
    printf("%d\n", cnt);
    for (int i = 0; i < cnt; i++)
      printf("%d%c", ans[i], i == cnt - 1 ? '\n' : ' ');
  }
  return 0;
}
