#include <bits/stdc++.h>
using namespace std;
int n, k;
int c[505];
int dp[500][500];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = k - c[i]; j >= 0; j--) {
      for (int o = 0; o <= k; o++) {
        if (dp[j][o] == 1) {
          dp[j + c[i]][o] = 1;
          if (o + c[i] <= k) {
            dp[j + c[i]][o + c[i]] = 1;
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= k; i++) {
    if (dp[k][i] == 1) {
      ans++;
    }
  }
  printf("%d\n", ans);
  int s = 0;
  for (int i = 0; i <= k; i++) {
    if (dp[k][i] == 1) {
      {
        printf("%d", i);
        s++;
        if (s == ans)
          printf("\n");
        else
          printf(" ");
      }
    }
  }
}
