#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, k, ans[maxn], a[maxn];
bool dp[2500][2500];
int main() {
  cin >> n >> k;
  dp[0][0] = 1;
  int num;
  while (n--) {
    cin >> num;
    for (int i = k; i >= num; --i) {
      for (int j = 0; j <= k - num; ++j) {
        if (dp[i - num][j]) dp[i][j + num] = dp[i][j] = 1;
      }
    }
  }
  int tot = 0;
  for (int j = 0; j <= 5000; ++j) {
    if (dp[k][j]) ans[++tot] = j;
  }
  cout << tot << endl;
  for (int i = 1; i <= tot; ++i) {
    cout << ans[i] << " ";
  }
  return 0;
}
