#include using namespace std; typedef long long ll; typedef vector< int > vi; typedef vector< vi > vvi; typedef vector< ll > vl; typedef vector< vl > vvl; typedef pair< int, int > pii; typedef vector< pii > vp; typedef vector< double > vd; typedef vector< vd > vvd; typedef vector< string > vs; template< class T1, class T2 > int upmin( T1 &x, T2 v ){ if( x > v ){ x = v; return 1; } return 0; } template< class T1, class T2 > int upmax( T1 &x, T2 v ){ if( x < v ){ x = v; return 1; } return 0; } const int INF = 0x3f3f3f3f; int N, S; vi P; void init(){ cin >> N >> S; P = vi( N ); for( int i = 0; i < N; ++i ){ cin >> P[ i ]; } } vvi ans; void preprocess(){ int n0 = N / 2, n1 = N - N / 2; vp v_ids; for( int s = 0; s < 1 << n1; ++s ){ int v = 0; for( int i = 0; i < n1; ++i ){ if( s & 1 << i ){ v += P[ n0 + i ]; } } v_ids.emplace_back( v, s ); } sort( v_ids.begin(), v_ids.end() ); for( int s = 0; s < 1 << n0; ++s ){ int v = 0; for( int i = 0; i < n0; ++i ){ if( s & 1 << i ){ v += P[ i ]; } } auto it = lower_bound( v_ids.begin(), v_ids.end(), make_pair( S - v, 0 ) ); for( auto a = it; a != v_ids.end(); ++a ){ if( a->first != S - v ){ break; } vi tmp; for( int i = 0; i < n0; ++i ){ if( s & 1 << i ){ tmp.emplace_back( i + 1 ); } } for( int i = 0; i < n1; ++i ){ if( a->second & 1 << i ){ tmp.emplace_back( n0 + i + 1 ); } } ans.emplace_back( tmp ); } } sort( ans.begin(), ans.end() ); } void solve(){ for( int i = 0; i < ans.size(); ++i ){ for( int j = 0; j < ans[ i ].size(); ++j ){ cout << ans[ i ][ j ] << " \n"[ j + 1 == ans[ i ].size() ]; } } } signed main(){ ios::sync_with_stdio( 0 ); init(); preprocess(); solve(); return 0; }