#include <bits/stdc++.h>
inline int Rand() { return (rand() << 16) | rand(); }
using namespace std;
const int N = 501, NN = 100001, SMALL = 105, ALPH = 28, BIG = 1000001;
int n, k, a[N];
bool was[N][N];
vector<int> ans;
int main() {
  srand(time(NULL));
  scanf("%d %d", &n, &k);
  for (int i = int(1); i <= int(n); i++) scanf("%d", &a[i]);
  was[0][0] = true;
  for (int i = int(1); i <= int(n); i++) {
    for (int j = int(k); j >= int(0); j--)
      for (int other = int(k); other >= int(0); other--) {
        if (was[j][other] && j + a[i] < N) was[j + a[i]][other] = true;
        if (was[j][other] && other + a[i] < N) was[j][other + a[i]] = true;
      }
  }
  for (int i = int(0); i <= int(k); i++)
    if (was[i][k - i]) ans.push_back(i);
  cout << ans.size() << endl;
  for (int i = int(0); i <= int(ans.size() - 1); i++) cout << ans[i] << " ";
  return 0;
}
