#include <bits/stdc++.h>
using namespace std;
int n, k, t = 0;
int c[505];
bool dp[505][505][505];
int ans[505];
int main() {
  while (scanf("%d %d", &n, &k) != EOF) {
    dp[0][0][0] = 1;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &c[i]);
    }
    for (int z = 1; z <= n; z++) {
      for (int i = 0; i <= k; i++) {
        for (int j = 0; j <= i && j <= k; j++) {
          if (dp[z - 1][i][j] || i >= c[z] && dp[z - 1][i - c[z]][j] ||
              j >= c[z] && dp[z - 1][i - c[z]][j - z[c]])
            dp[z][i][j] = 1;
        }
      }
    }
    for (int i = 0; i <= k; i++) {
      if (dp[n][k][i]) {
        t++;
        ans[t] = i;
      }
    }
    printf("%d\n", t);
    for (int i = 1; i < t; i++) {
      printf("%d ", ans[i]);
    }
    printf("%d\n", ans[t]);
  }
}
