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