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