#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<vector<vector<int>>> dp(
      2, vector<vector<int>>(k + 1, vector<int>(k + 1)));
  dp[0][0][0] = 1;
  int ans = 0;
  set<int> sad;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      for (int l = 0; l <= j; ++l) {
        int i2 = i % 2;
        dp[i2][j][l] = dp[abs(i2 - 1)][j][l];
        if (a[i] <= j) {
          dp[i2][j][l] =
              max(dp[abs(i2 - 1)][j][l], dp[abs(i2 - 1)][j - a[i]][l]);
          if (a[i] <= l) {
            dp[i2][j][l] =
                max(dp[i2][j][l], dp[abs(i2 - 1)][j - a[i]][l - a[i]]);
          }
        }
        if (i == n && j == k && dp[i2][j][l] != 0) {
          ++ans;
          sad.insert(l);
        }
      }
    }
  }
  cout << ans << endl;
  for (auto i : sad) {
    cout << i << " ";
  }
}
