#include <bits/stdc++.h>
using namespace std;
int n, k;
int c[1005];
int dp[1005][1005];
int ans = 0;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> c[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = k; j >= c[i]; j--)
      for (int l = 0; l <= k - c[i]; l++)
        if (dp[j - c[i]][l]) dp[j][l] = dp[j][l + c[i]] = 1;
  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;
  return 0;
}
