#include <bits/stdc++.h>
using namespace std;
long long c[1100];
bool dp[1100][1100];
vector<long long> vec;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> c[i];
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int a = 500; a >= 0; a--) {
      for (int b = 500; b >= 0; b--) {
        if (dp[a][b] == 1) {
          dp[a + c[i]][b] = 1;
          dp[a][b + c[i]] = 1;
        }
      }
    }
  }
  for (int i = 0; i <= k; i++)
    if (dp[i][k - i] == 1) vec.push_back(i);
  cout << vec.size() << endl;
  for (int i = 0; i < vec.size(); i++) cout << vec[i] << " ";
}
