#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 10;
int n, k, x, ar[N], dp[2][N][N];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> ar[i];
  dp[0][0][0] = dp[0][0][ar[0]] = dp[0][ar[0]][ar[0]] = 1;
  for (int i = 1; i < n; i++) {
    int x = ar[i], now = i & 1, prv = ((i - 1) & 1);
    for (int i3 = 0; i3 <= k; i3++)
      for (int i2 = 0; i2 <= i3; i2++) {
        dp[now][i2][i3] = dp[prv][i2][i3];
        if (i3 >= x) dp[now][i2][i3] |= dp[prv][i2][i3 - x];
        if (i3 >= x && i2 >= x) dp[now][i2][i3] |= dp[prv][i2 - x][i3 - x];
      }
  }
  int ans = 0;
  for (int i = 0; i <= k; i++)
    if (dp[(n - 1) & 1][i][k]) ans++;
  cout << ans << '\n';
  for (int i = 0; i <= k; i++)
    if (dp[(n - 1) & 1][i][k]) cout << i << " ";
}
