#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 5;
int n, k;
int a[N];
bool dp[N][N];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int rem = k - a[i]; rem >= 0; rem--) {
      for (int sum = 0; sum <= k; sum++) {
        dp[rem + a[i]][sum] |= dp[rem][sum];
        if (sum + a[i] <= k) dp[rem + a[i]][sum + a[i]] |= dp[rem][sum];
      }
    }
  }
  vector<int> v;
  for (int i = 0; i <= k; i++)
    if (dp[k][i]) v.push_back(i);
  printf("%d\n", v.size());
  for (auto x : v) printf("%d ", x);
  puts("");
  return 0;
}
