#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long inff = 0x3f3f3f3f3f3f3f3f;
const int N = 5e2 + 8;
int n, kk, a[N], dp[2][N][N];
int main() {
  cin.tie(0);
  cout.tie(0);
  cin >> n >> kk;
  int qw = 0;
  dp[qw ^ 1][0][0] = 1;
  for (int i(1); i <= (n); ++i) {
    scanf("%d", &a[i]);
    for (int j(0); j <= (kk); ++j)
      for (int k(0); k <= (kk); ++k) dp[qw][j][k] = dp[qw ^ 1][j][k];
    for (int j(kk); j >= (a[i]); --j)
      for (int k(kk); k >= (0); --k)
        dp[qw][j][k] = max(dp[qw][j][k], dp[qw ^ 1][j - a[i]][k]);
    for (int j(kk); j >= (a[i]); --j)
      for (int k(kk); k >= (0); --k)
        dp[qw][k][j] = max(dp[qw][k][j], dp[qw ^ 1][k][j - a[i]]);
    qw ^= 1;
  }
  qw ^= 1;
  int num = 0;
  for (int i(0); i <= (kk); ++i)
    if (dp[qw][i][kk - i]) num++;
  cout << num << endl;
  for (int i(0); i <= (kk); ++i)
    if (dp[qw][i][kk - i]) printf("%d ", i);
  puts("");
  return 0;
}
