#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f;
const double pi = acos(-1.0);
const double eps = 1e-8;
const long long mod = 1e9 + 7;
const unsigned long long mx = 133333331;
inline void RI(int &x) {
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';
}
int dp[2][505][505];
int a[505];
int main() {
  int n, k;
  while (cin >> n >> k) {
    int cnt = 0;
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      cnt ^= 1;
      memset(dp[cnt], 0, sizeof(dp[cnt]));
      for (int j = k; j >= 0; j--) {
        for (int h = j; h >= 0; h--) {
          if (h >= a[i])
            dp[cnt][j][h] = max(dp[cnt][j][h], dp[cnt ^ 1][j - a[i]][h - a[i]]);
          if (j >= a[i])
            dp[cnt][j][h] = max(dp[cnt][j][h], dp[cnt ^ 1][j - a[i]][h]);
          dp[cnt][j][h] = max(dp[cnt][j][h], dp[cnt ^ 1][j][h]);
        }
      }
    }
    vector<int> ans;
    for (int i = 0; i <= k; i++) {
      if (dp[cnt][k][i]) {
        ans.push_back(i);
      }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
      printf("%d", ans[i]);
      if (i == ans.size() - 1)
        printf("\n");
      else
        printf(" ");
    }
  }
  return 0;
}
