#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
bool dp[501][501][501];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int arr[501];
  for (int i = 0; i < n; i += 1) {
    cin >> arr[i];
  }
  memset(dp, (0), sizeof(dp));
  dp[0][arr[0]][0] = true;
  dp[0][arr[0]][arr[0]] = true;
  dp[0][0][0] = true;
  for (int i = 0; i < n - 1; i += 1) {
    for (int a = 0; a < k + 1; a += 1) {
      if (a + arr[i + 1] <= k) {
        for (int b = 0; b < k + 1; b += 1) {
          dp[i + 1][a + arr[i + 1]][b] |= dp[i][a][b];
          if (b + arr[i + 1] <= k)
            dp[i + 1][a + arr[i + 1]][b + arr[i + 1]] |= dp[i][a][b];
        }
      }
      for (int b = 0; b < k + 1; b += 1) {
        dp[i + 1][a][b] |= dp[i][a][b];
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i < k + 1; i += 1) {
    if (dp[n - 1][k][i]) ans.push_back(i);
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i += 1) {
    if (i == 0)
      cout << ans[i];
    else
      cout << " " << ans[i];
  }
  return 0;
}
