#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const long long mod = 1e9 + 7;
int power(int a, int p) {
  int r = 1, y = a;
  while (p) {
    if (p & 1) r = (1LL * r * y) % mod;
    p >>= 1;
    y = (1LL * y * y) % mod;
  }
  return r;
}
int ara[N];
bool dp[3][N][N];
vector<int> v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  v.push_back(0);
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int cur = i % 2;
    int prev = (cur ^ 1);
    for (int x = 0; x <= k; x++)
      for (int y = 0; y <= k; y++) dp[cur][x][y] = 0;
    for (int j = 0; j <= k; j++) {
      for (int x = 0; x <= k; x++) {
        bool res = dp[prev][j][x];
        if (j - v[i] >= 0) {
          res |= dp[prev][j - v[i]][x];
          if (x - v[i] >= 0) res |= dp[prev][j - v[i]][x - v[i]];
        }
        dp[cur][j][x] = res;
        if (res) {
        }
      }
    }
  }
  int pos = n % 2;
  vector<int> res;
  for (int i = 0; i <= k; i++)
    if (dp[pos][k][i]) res.push_back(i);
  cout << res.size() << endl;
  for (int x : res) cout << x << " ";
  cout << endl;
}
