#include <bits/stdc++.h>
using namespace std;
int dp[501][501];
int a[501];
int n, K;
int main() {
  cin >> n >> K;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = K; j >= 0; j--) {
      for (int k = K; k >= 0; k--) {
        if (dp[j][k]) dp[j][k] = 1;
        int value = a[i];
        if (j >= value && dp[j - value][k]) dp[j][k] = 1;
        if (j >= value && k >= value && dp[j - value][k - value]) dp[j][k] = 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= K; i++) {
    if (dp[K][i]) ans++;
  }
  cout << ans << endl;
  for (int i = 0; i <= K; i++) {
    if (dp[K][i]) cout << i << " ";
  }
  cout << endl;
}
