#include<bits/stdc++.h>usingnamespacestd;intN,H;constintINF=INT_MAX;vector<vector<int>>cows;intbitmask(intoriginal,intadd){original|=1UL<<add;returnoriginal;}intunbit(intn,intk){return(n&(1<<k))>>k;}intheight(intn){intans=0;for(inti=0;i<N;i++){if(unbit(n,i)){ans+=cows[i][0];}}returnans;}signedmain(){ifstreamcin("guard.in");ofstreamcout("guard.out");cin>>N>>H;cows.resize(N);for(inti=0;i<N;i++){vector<int>cowinfo(3);cin>>cowinfo[0]>>cowinfo[1]>>cowinfo[2];cows[i]=cowinfo;}// dp[subset of cows used] = maxweightvector<int>dp(pow(2,N));intans=0;dp[0]=INF;for(inti=0;i<pow(2,N);i++){for(intj=0;j<N;j++){// see if you can add jif(!unbit(i,j)&&dp[i]-cows[j][1]>=0){// subset including jintsubset=bitmask(i,j);dp[subset]=max(dp[subset],min(cows[j][2],dp[i]-cows[j][1]));// if height > , add to ansif(height(subset)>=H){ans=max(ans,dp[subset]);}}}}if(ans==0){cout<<"Mark is too tall";return0;}cout<<ans;}