#include using namespace std; using ll=long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll N,M; cin>>N>>M; vector E(N); for(int i=0;i>E[i]; reverse(E.begin(),E.end()); vector V(M),W(M); for(int i=0;i>V[i]>>W[i]; vector SV(1<> DP(N+1,vector(1<= 0; b = (b - 1) & bit) { if(SW[b]<=E[i]){ DP[i+1][pit+b]=max(DP[i+1][pit+b],DP[i][pit]+SV[b]); } if (b == 0)break; } } } ll an=-1e18,mbit=0;; for(int bit=0;bit<(1<=0;i--){ for (ll b = mbit; b >= 0; b = (b - 1) & mbit) { if(DP[i][b]+SV[mbit-b]==DP[i+1][mbit]&&SW[mbit-b]<=E[i]){ ll pit=mbit-b; cout<<__builtin_popcount(pit); for(int j=0;j