#include <bits/stdc++.h>
using namespace std;
namespace fast_things {
template <class T>
class splay {
 private:
  struct node {
    node *L, *R;
    T key;
    node() {
      L = NULL;
      R = NULL;
    }
    node(const T a) {
      key = a;
      L = NULL;
      R = NULL;
    }
  };
  node *root;
  node *path[50];
  long long iter;
  inline bool getpath(const T a) {
    iter = 0;
    if (root == NULL) {
      return false;
    }
    node *cur = root;
    path[iter++] = cur;
    while (cur->key != a) {
      if (cur->key > a)
        cur = cur->L;
      else
        cur = cur->R;
      if (cur == NULL) return false;
      path[iter++] = cur;
    }
    return true;
  }
  inline void Getpath(const T a) {
    iter = 0;
    if (root == NULL) {
      root = new node(a);
      path[iter++] = root;
      return;
    }
    node *cur = root;
    path[iter++] = cur;
    while (cur->key != a) {
      if (cur->key > a)
        if (cur->L == NULL) {
          cur->L = new node(a);
          path[iter++] = cur->L;
          return;
        } else
          cur = cur->L;
      else if (cur->R == NULL) {
        cur->R = new node(a);
        path[iter++] = cur->R;
        return;
      } else
        cur = cur->R;
      path[iter++] = cur;
    }
  }
  void Splay() {
    long long i = iter - 1;
    root = path[i];
    for (; i > 2;) {
      i -= 2;
      if (path[i]->L == path[i + 1])
        if (path[i + 1]->L == path[i + 2]) {
          bool leftish = (path[i - 1]->L == path[i]);
          path[i]->L = path[i + 1]->R;
          path[i + 1]->R = path[i];
          path[i + 1]->L = path[i + 2]->R;
          path[i + 2]->R = path[i + 1];
          swap(path[i + 2], path[i]);
          if (leftish)
            path[i - 1]->L = path[i];
          else
            path[i - 1]->R = path[i];
        } else {
          bool leftish = (path[i - 1]->L == path[i]);
          path[i]->L = path[i + 2]->R;
          path[i + 1]->R = path[i + 2]->L;
          path[i + 2]->L = path[i + 1];
          path[i + 2]->R = path[i];
          swap(path[i + 2], path[i]);
          if (leftish)
            path[i - 1]->L = path[i];
          else
            path[i - 1]->R = path[i];
        }
      else if (path[i + 1]->L == path[i + 2]) {
        bool leftish = (path[i - 1]->L == path[i]);
        path[i]->R = path[i + 2]->L;
        path[i + 1]->L = path[i + 2]->R;
        path[i + 2]->R = path[i + 1];
        path[i + 2]->L = path[i];
        swap(path[i + 2], path[i]);
        if (leftish)
          path[i - 1]->L = path[i];
        else
          path[i - 1]->R = path[i];
      } else {
        bool leftish = (path[i - 1]->L == path[i]);
        path[i]->R = path[i + 1]->L;
        path[i + 1]->L = path[i];
        path[i + 1]->R = path[i + 2]->L;
        path[i + 2]->L = path[i + 1];
        swap(path[i + 2], path[i]);
        if (leftish)
          path[i - 1]->L = path[i];
        else
          path[i - 1]->R = path[i];
      }
    }
    if (i == 2) {
      i -= 2;
      if (path[i]->L == path[i + 1])
        if (path[i + 1]->L == path[i + 2]) {
          path[i]->L = path[i + 1]->R;
          path[i + 1]->R = path[i];
          path[i + 1]->L = path[i + 2]->R;
          path[i + 2]->R = path[i + 1];
        } else {
          path[i]->L = path[i + 2]->R;
          path[i + 1]->R = path[i + 2]->L;
          path[i + 2]->L = path[i + 1];
          path[i + 2]->R = path[i];
        }
      else if (path[i + 1]->L == path[i + 2]) {
        path[i]->R = path[i + 2]->L;
        path[i + 1]->L = path[i + 2]->R;
        path[i + 2]->R = path[i + 1];
        path[i + 2]->L = path[i];
      } else {
        path[i]->R = path[i + 1]->L;
        path[i + 1]->L = path[i];
        path[i + 1]->R = path[i + 2]->L;
        path[i + 2]->L = path[i + 1];
      }
    }
    if (i == 1) {
      i = 0;
      if (path[0]->L == path[1]) {
        path[0]->L = path[1]->R;
        path[1]->R = path[0];
      } else {
        path[0]->R = path[1]->L;
        path[1]->L = path[0];
      }
    }
  }

 public:
  bool empty() { return (root == NULL); }
  T extractmin() {
    node *c1 = root, *c2 = root->L;
    if (c2 == NULL) {
      T val = root->key;
      root = root->R;
      return val;
    } else {
      while (c2->L != NULL) c2 = c2->L, c1 = c1->L;
      c1->L = c2->R;
      return c2->key;
    }
  }
  splay() { root = NULL; }
  void insert(const T x) {
    Getpath(x);
    Splay();
  }
  bool check(const T x) {
    bool res = getpath(x);
    if (res) {
      Splay();
      return true;
    }
    return false;
  }
  void erase(const T x) {
    if (!getpath(x)) return;
    if (path[iter - 1]->R != NULL) {
      path[iter] = path[iter - 1]->R;
      ++iter;
      while (path[iter - 1]->L != NULL) {
        path[iter] = path[iter - 1]->L;
        ++iter;
      }
      Splay();
      getpath(x);
      Splay();
      root->R->L = root->L;
      root = root->R;
      return;
    }
    for (long long i = iter - 2; i >= 0; --i) {
      if (path[i + 1] != path[i]->R) {
        iter = i + 1;
        Splay();
        getpath(x);
        Splay();
        root->R->L = root->L;
        root = root->R;
        return;
      }
    }
    Splay();
    root = root->L;
  }
};
inline long long readChar();
template <class T = long long>
inline T readInt();
template <class T>
inline void writeInt(T x);
inline void writeChar(long long x);
inline void writeWord(const char *s);
inline void flush();
static const long long buf_size = 4096;
inline long long getChar() {
  static char buf[buf_size];
  static long long len = 0, pos = 0;
  if (pos == len) pos = 0, len = fread(buf, 1, buf_size, stdin);
  if (pos == len) return -1;
  return buf[pos++];
}
inline long long readChar() {
  long long c = getChar();
  while (c <= 32) c = getChar();
  return c;
}
template <class T>
inline T readInt() {
  long long s = 1, c = readChar();
  T x = 0;
  if (c == '-') s = -1, c = getChar();
  while ('0' <= c && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getChar();
  return s == 1 ? x : -x;
}
static long long write_pos = 0;
static char write_buf[buf_size];
inline void writeChar(long long x) {
  if (write_pos == buf_size)
    fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
  write_buf[write_pos++] = x;
}
inline void flush() {
  if (write_pos) fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
}
template <class T>
inline void writeInt(T x) {
  if (x < 0) writeChar('-'), x = -x;
  char s[24];
  long long n = 0;
  while (x || !n) s[n++] = '0' + x % 10, x /= 10;
  while (n--) writeChar(s[n]);
}
inline void writeWord(const char *s) {
  while (*s) writeChar(*s++);
}
}  // namespace fast_things
using namespace fast_things;
const int N = 501;
bitset<N> visited[N];
bitset<N> answer;
bool were[N];
int c[N];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> c[i];
  for (int iter = 0; iter < 150; ++iter) {
    random_shuffle(c, c + n);
    memset(visited, 0, sizeof(visited));
    memset(were, 0, sizeof(were));
    visited[0][0] = 1;
    were[0] = true;
    for (int j = 0; j < n; ++j) {
      int val = c[j];
      for (int i = k - val; i >= 0; --i)
        if (were[i]) {
          were[i + val] = 1;
          visited[i + val][i + val] = 1;
          visited[i + val] |= visited[i];
        }
    }
    answer |= visited[k];
  }
  vector<int> ans;
  for (int i = 0; i <= k; ++i)
    if (answer[i]) ans.push_back(i), ans.push_back(k - i);
  sort(ans.begin(), ans.end());
  ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
  cout << ans.size() << endl;
  for (auto x : ans) cout << x << " ";
  return 0;
}
