#include <bits/stdc++.h>
int main() {
  bool dp[505][505] = {0};
  int n, money;
  scanf("%d%d", &n, &money);
  int a[505];
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = money - a[i]; j >= 0; j--)
      for (int k = j; k >= 0; k--) {
        if (dp[j][k]) {
          dp[j + a[i]][k + a[i]] = 1;
          dp[j + a[i]][k] = 1;
        }
      }
  }
  int sum = 0;
  {
    for (int i = 0; i <= money; i++)
      if (dp[money][i]) {
        sum++;
      }
  }
  printf("%d\n", sum);
  {
    for (int i = 0; i <= money; i++)
      if (dp[money][i]) {
        if (i)
          printf(" %d", i);
        else
          printf("0");
      }
  }
  printf("\n");
  return 0;
}
