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