#include using namespace std; using ll = long long; using vi = vector; using vb = vector; using vd = vector; using vl = vector; using vvi = vector; using vvb = vector; using vvd = vector; using vvl = vector; #define REP(i,n) for(ll i=0; i<(n); ++i) #define FOR(i,b,n) for(ll i=(b); i<(n); ++i) #define ALL(v) (v).begin(), (v).end() void dfs(const vl & p, ll index, vi v, vector> & p_1) { if (index == p.size()/2) { ll sum = 0; for(auto i : v) sum += p[i]; p_1.push_back({v, sum}); return; } v.push_back(index); dfs(p, index+1, v, p_1); v.pop_back(); dfs(p, index+1, v, p_1); } void dfs2(const vl & p, ll index, vi v, map & p_2) { if (index == p.size()) { ll sum = 0; for(auto i : v) sum += p[i]; p_2[sum].push_back(v); return; } v.push_back(index); dfs2(p, index+1, v, p_2); v.pop_back(); dfs2(p, index+1, v, p_2); } int main() { // cin.tie(0); // ios_base::sync_with_stdio(false); // cout << fixed << setprecision(5); ll n, s; cin >> n >> s; vl p(n); for (auto&&i : p) cin >> i; vector> p_1; dfs(p, 0, {}, p_1); map p_2; dfs2(p, p.size()/2, {}, p_2); for (auto & _ : p_1) { auto it = p_2.find(s - _.second); if (it == p_2.end()) continue; auto & item1 = _.first; for (auto & item2 : it->second) { if (!item1.empty()) cout << item1[0]+1; FOR(i, 1, item1.size()) cout << " " << item1[i]+1; if (!item1.empty() && !item2.empty()) cout << " "; if (!item2.empty()) cout << item2[0]+1; FOR(i, 1, item2.size()) cout << " " << item2[i]+1; cout << endl; } } return 0; }