#include <bits/stdc++.h>
using namespace std;
const int INF = numeric_limits<int>::max();
const long long LLINF = numeric_limits<long long>::max();
const unsigned long long ULLINF = numeric_limits<unsigned long long>::max();
const double PI = acos(-1.0);
int n, k;
const int maxn = 510;
bitset<maxn> dp[510][510];
int c[510];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> c[i];
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int s = 0; s <= k; s++) {
      dp[i + 1][s] |= dp[i][s];
      if (s + c[i] <= k) dp[i + 1][s + c[i]] |= (dp[i][s] | (dp[i][s] << c[i]));
    }
  }
  vector<int> ans;
  for (int i = 0; i <= k; i++)
    if (dp[n][k][i]) ans.push_back(i);
  cout << ans.size() << '\n';
  for (int i : ans) cout << i << " ";
  return 0;
}
