#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000001;
const long long int LLINF = 1000000000000000001LL;
const int C = 1004;
bool dp[C][C];
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  dp[0][0] = 1;
  for (int i = (1); i <= (n); ++i) {
    int val;
    cin >> val;
    for (int sum = (2 * k); sum >= (0); --sum)
      for (int s1 = (0); s1 <= (min(sum, k)); ++s1) {
        int s2 = sum - s1;
        if (s2 <= k && dp[s1][s2]) {
          dp[s1 + val][s2] = 1;
          dp[s1][s2 + val] = 1;
        }
      }
  }
  vector<int> ans;
  for (int x = (0); x <= (k); ++x)
    if (dp[x][k - x]) {
      ans.push_back(x);
    }
  cout << (int)(ans).size() << '\n';
  for (int val : ans) {
    cout << val << ' ';
  }
  return 0;
}
