#include using namespace std; int main(){ int N, S; cin >> N >> S; vector P(N); for (int i = 0; i < N; i++){ cin >> P[i]; } int A = N / 2; int B = N - A; map>> mpA; for (int i = 0; i < (1 << A); i++){ int sum = 0; vector s; for (int j = 0; j < A; j++){ if (i >> j & 1){ sum += P[j]; s.push_back(j); } } mpA[sum].push_back(s); } map>> mpB; for (int i = 0; i < (1 << B); i++){ int sum = 0; vector s; for (int j = 0; j < B; j++){ if (i >> j & 1){ sum += P[A + j]; s.push_back(A + j); } } mpB[sum].push_back(s); } vector> ans; for (auto p : mpB){ if (mpA.count(S - p.first)){ for (auto a : mpA[S - p.first]){ for (auto b : p.second){ vector tmp; for (int x : a){ tmp.push_back(x); } for (int x : b){ tmp.push_back(x); } ans.push_back(tmp); } } } } sort(ans.begin(), ans.end()); int cnt = ans.size(); for (int i = 0; i < cnt; i++){ int cnt2 = ans[i].size(); for (int j = 0; j < cnt2; j++){ cout << ans[i][j] + 1; if (j < cnt2 - 1){ cout << ' '; } } cout << endl; } }