#include <bits/stdc++.h>
using namespace std;
int n, m, x[5005], ans[5005];
bool dp[5005][5005];
int main() {
  dp[0][0] = 1;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  for (int i = 1; i <= n; i++)
    for (int j = m; j >= x[i]; j--)
      if (dp[j - x[i]][j - x[i]]) {
        for (int k = m; k >= 0; k--)
          if (dp[j - x[i]][k]) dp[j][k] = 1, dp[j][k + x[i]] = 1;
      }
  for (int i = 0; i <= m; i++)
    if (dp[m][i]) ans[++ans[0]] = i;
  printf("%d\n", ans[0]);
  for (int i = 1; i <= ans[0]; i++) printf("%d ", ans[i]);
  return 0;
}
