#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 505, maxm = 29;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, m, c[maxn];
bitset<maxn> dp[maxn];
int main() {
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", c + i);
  dp[0][0] = 1;
  for (i = 0; i < n; i++) {
    for (j = m; j >= c[i]; j--) {
      dp[j] |= (dp[j - c[i]] << c[i]);
      dp[j] |= dp[j - c[i]];
    }
  }
  int s = 0;
  for (i = 0; i <= m; i++) s += dp[m][i];
  printf("%d\n", s);
  for (i = 0; i <= m; i++)
    if (dp[m][i]) printf("%d ", i);
  printf("\n");
  return 0;
}
