#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int dp[2][N][N];
int c[N];
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int x = c[i];
    int now = i % 2;
    int last = 1 - now;
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= j; l++) {
        dp[now][j][l] = dp[last][j][l];
        if (x <= j) {
          dp[now][j][l] |= dp[last][j - x][l];
          if (x <= l) {
            dp[now][j][l] |= dp[last][j - x][l - x];
          }
        }
      }
    }
  }
  int t = n % 2;
  for (int i = 0; i <= k; i++) {
    if (dp[t][k][i]) {
      v.push_back(i);
    }
  }
  cout << v.size() << "\n";
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  return 0;
}
