#include <bits/stdc++.h>
using namespace std;
void boost() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = 1e6;
const long long inf = 1e9 + 7;
const long double PI = acos(-1);
template <typename A, typename B>
bool mini(A& x, const B& y) {
  if (y < x) {
    x = y;
    return 1;
  }
  return 0;
}
long long bin_pow(long long x, long long y) {
  long long res = 1, base = x;
  while (y) {
    if (y & 1) {
      res *= base;
      res %= inf;
    }
    base *= base;
    base %= inf;
    y /= 2;
  }
  return res;
}
bitset<600> sum[600];
int n, k, c[600];
vector<int> ans;
int main() {
  boost();
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  sum[0][0] = 1;
  sort(c + 1, c + 1 + n);
  for (int i = 1; i <= n; i++) {
    for (int j = k; j >= 0; j--) {
      if (sum[j][j] == 0) {
        continue;
      }
      if (j + c[i] > 500) {
        continue;
      }
      sum[j + c[i]] |= (sum[j]);
      sum[j + c[i]] |= (sum[j] << c[i]);
    }
  }
  for (int i = 0; i <= k; i++) {
    if (sum[k][i]) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
}
