#include using namespace std; using pii = pair; using ll = long long; #define rep(i, j) for(int i=0; i < (int)(j); i++) #define repeat(i, j, k) for(int i = (j); i < (int)(k); i++) #define all(v) v.begin(),v.end() #define debug(x) cerr << #x << " : " << x << endl template bool set_min(T &a, const T &b) { return a > b ? a = b, true : false; } template bool set_max(T &a, const T &b) { return a < b ? a = b, true : false; } // vector template istream& operator >> (istream &is , vector &v) { for(T &a : v) is >> a; return is; } template ostream& operator << (ostream &os , const vector &v) { for(const T &t : v) os << "\t" << t; return os << endl; } // pair template ostream& operator << (ostream &os , const pair &v) { return os << "<" << v.first << ", " << v.second << ">"; } const int INF = 1 << 30; const ll INFL = 1LL << 60; class Solver { public: bool solve() { int N; cin >> N; ll S; cin >> S; vector P(N); cin >> P; set ans; map> memo; int N1 = min(N, 15); for(uint32_t bit = 0; bit < (1 << N1); bit++) { ll sum = 0; rep(j, N1) if(bit & (1 << j)) sum += P[j]; memo[sum].push_back(bit); } /* for(auto &p : memo) { cerr << "金額 " << p.first << p.second << endl; } */ int N2 = N - N1; for(uint32_t bit = 0; bit < (1 << N2); bit++) { ll sum = 0; rep(j, N2) if(bit & (1 << j)) sum += P[j + N1]; ll need = S - sum; if(memo.count(need)) { for(auto &b : memo[need]) { ans.insert(b | (bit << N1)); } } } set> ans_n; for(auto bit : ans) { set a; rep(i, N) if(bit & (1 << i)) a.insert(i + 1); if(a.size()) ans_n.insert(a); } for(auto &s : ans_n) { for(auto &i : s) { cout << i << (i == *s.rbegin() ? "\n" : " "); } } return 0; } }; int main() { cin.tie(0); ios::sync_with_stdio(false); Solver s; s.solve(); return 0; }