#include <bits/stdc++.h>
using namespace std;
bool dp[505][505];
int main() {
  int n, k, x;
  vector<int> a;
  while (scanf("%d%d", &n, &k) != EOF) {
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &x);
      for (int j = k; j >= x; j--) {
        for (int s = 0; s <= j - x; s++) {
          if (dp[j - x][s]) dp[j][s] = dp[j][s + x] = 1;
        }
      }
    }
    a.clear();
    int cnt = 0;
    for (int i = 0; i <= k; i++)
      if (dp[k][i]) {
        a.push_back(i);
        cnt++;
      }
    printf("%d\n", cnt);
    for (int i = 0; i < cnt - 1; i++) printf("%d ", a[i]);
    printf("%d\n", a[cnt - 1]);
  }
}
