#include <bits/stdc++.h>
using namespace std;
long long dp[2][502][502], cur;
signed main() {
  ios_base::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < 2; i++)
    for (long long j = 0; j < k + 1; j++)
      for (long long u = 0; u < k + 1; u++) dp[i][j][u] = 0;
  dp[0][0][0] = 1;
  for (long long i = 1; i < n + 1; i++) {
    cur = 1 - cur;
    for (long long j = 0; j < k + 1; j++) {
      for (long long u = 0; u < k + 1; u++) {
        if (dp[1 - cur][j][u]) dp[cur][j][u] = 1;
        if ((j - a[i - 1]) >= 0 && (dp[1 - cur][j - a[i - 1]][u]))
          dp[cur][j][u] = 1;
        if ((j - a[i - 1]) >= 0 && (u - a[i - 1]) >= 0 &&
            dp[1 - cur][j - a[i - 1]][u - a[i - 1]])
          dp[cur][j][u] = 1;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < k + 1; i++)
    if (dp[cur][k][i]) ans++;
  cout << ans << endl;
  for (long long i = 0; i < k + 1; i++)
    if (dp[cur][k][i]) cout << i << " ";
}
