#include <bits/stdc++.h>
using namespace std;
long long int N = 1e9 + 7;
int dp[2][504][504];
void solve() {
  memset(dp, 0, sizeof(dp));
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0][0] = 1;
  int z = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= j; l++) {
        dp[z][j][l] = max(dp[z][j][l], dp[1 - z][j][l]);
        if (j >= a[i]) {
          if (l >= a[i]) {
            dp[z][j][l] = max(dp[z][j][l], dp[1 - z][j - a[i]][l - a[i]]);
          }
          dp[z][j][l] = max(dp[z][j][l], dp[1 - z][j - a[i]][l]);
        }
      }
    }
    memset(dp[1 - z], 0, sizeof(dp[1 - z]));
    z = 1 - z;
  }
  vector<int> order;
  for (int i = 0; i <= k; i++) {
    if (dp[1 - z][k][i]) {
      order.push_back(i);
    }
  }
  cout << order.size() << endl;
  for (auto v : order) {
    cout << v << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
}
