#include <bits/stdc++.h>
using namespace std;
long long inf = (long long)1e18;
long long infint = (int)2e9;
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int a[n + 5];
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum = min(sum, k);
  long long dp[sum + 5][sum + 5];
  for (int i = 0; i <= sum; i++)
    for (int j = 0; j <= sum; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  if (a[0] <= sum) dp[a[0]][0] = 1;
  if (a[0] <= sum) dp[a[0]][a[0]] = 1;
  for (int i = 1; i < n; i++) {
    long long cnt[sum + 5][sum + 5];
    for (int j = 0; j <= sum; j++)
      for (int j1 = 0; j1 <= sum; j1++) cnt[j][j1] = dp[j][j1];
    for (int j = 0; j <= sum; j++)
      for (int j1 = 0; j1 <= sum; j1++)
        if (cnt[j][j1]) {
          if (j + a[i] <= sum) dp[j + a[i]][j1] = 1;
          if (j + a[i] <= sum and j1 + a[i] <= sum) dp[j + a[i]][j1 + a[i]] = 1;
          dp[j][j1] = 1;
        }
  }
  vector<long long> ans;
  for (int i = 0; i <= sum; i++)
    if (dp[k][i]) ans.push_back(i);
  cout << ans.size() << endl;
  for (int i = 0; i < (int)ans.size(); i++) cout << ans[i] << " ";
}
