#include <bits/stdc++.h>
using namespace std;
const long long N = 500 + 2, MOD = 1e9 + 7;
long long n, s, a[N];
bool dp[N][N][N];
void solve(long long tt) {
  cin >> n >> s;
  dp[1][0][0] = true;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    for (long long j = 0; j <= s; j++) {
      for (long long k = 0; k <= s; k++) {
        if (dp[i][j][k]) {
          dp[i + 1][j][k] = true;
          if (a[i] + j <= s) dp[i + 1][a[i] + j][k] = true;
          if (a[i] + k <= s) dp[i + 1][j][a[i] + k] = true;
        }
      }
    }
  }
  vector<long long> res;
  for (long long i = 0; i <= s; i++)
    if (dp[n + 1][i][s - i]) res.push_back(i);
  cout << res.size() << endl;
  for (auto x : res) cout << x << " ";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long TestCases = 1;
  for (long long i = 1; i <= TestCases; i++) solve(i);
  return 0;
}
