#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

struct Counter
{
	static int k;
	Counter() {k++;}
	~Counter() {k--;}
};

int Counter::k = 0;

template<typename T>
void pr(const string& name, T t)
{
    cout << name << " = " << t << endl;
}

template<typename T, typename ... Types>
void pr(const string& names, T t, Types ... rest)
{
    auto comma_pos = names.find(',');
    cout << names.substr(0, comma_pos) << " = " << t << ", ";

    auto next_name_pos = names.find_first_not_of(" \t\n", comma_pos + 1);
    pr(string(names, next_name_pos), rest ...);
}

void mod(ll &a, ll b)
{
    a %= b;
    if(a < 0) a += b;
}

#define all(x) x.begin(), x.end()
#define f(i,a,b) for(int i = (a); i <= (b); i++)
#define fd(i,a,b) for(int i = (a); i >= (b); i--)
#define mp make_pair
#define faster_io() ios_base::sync_with_stdio(false)
#define pb push_back
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
#define trace(...) pr(#__VA_ARGS__, __VA_ARGS__);
#define tracea(x) {string s = #x; Counter c##x; cout<<s.substr(0,1+s.find('['))<<Counter::k<<"]="<<x<<'\n';}
#define vii vector<pair<int,int>>

const ll MOD = 1000000007;

// ----------------------------------------------------------------------------------------------------------

ifstream fin("guard.in");
ofstream fout("guard.out");

struct Cow
{
    ll h, w, str;
    Cow(ll p1, ll p2, ll p3) : h(p1), w(p2), str(p3) {};
    friend bool operator < (Cow c1, Cow c2)
    {
        return c1.str > c2.str;
    }
};

const ll INF = 1000000000000000000ll;
ll N, J, Rem[1100000], H[1100000];
vector<Cow> V;

int main()
{
    fin >> N >> J;

    f(i,1,N)
    {
        ll h, w, str;
        fin >> h >> w >> str;
        V.pb(Cow(h,w,str));
    }

    ll ans = -1;
    Rem[0] = INF;

    f(m,1,(1<<N)-1) Rem[m] = -INF;

    f(m,0,(1<<N)-1)
    {
        if(H[m] >= J) ans = max(ans, Rem[m]);
        f(i,0,N-1) if(!(m&(1<<i)))
        {
            ll next_rem = min(Rem[m] - V[i].w, V[i].str);
            ll next_h = H[m] + V[i].h;
            ll next_mask = m + (1<<i);
            H[next_mask] = next_h;
            Rem[next_mask] = max(Rem[next_mask], next_rem);
        }
    }

    if(ans >= 0) fout << ans;
    else fout << "Mark is too tall";
}
