#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;
const int N = 502;
int n, lim, in[N], out[N], w[N], s[N], v[N];
int cmp[2 * N];
int dp[N][1001];
int dp2[2 * N], stamp[2 * N];
int main() {
  vector<pair<pair<int, int>, int> > ordByL, ordByW;
  vector<int> ls;
  cin >> n >> lim;
  for (int i = 0; i < (int)n; i++) {
    cin >> in[i] >> out[i] >> w[i] >> s[i] >> v[i];
    ordByL.push_back(make_pair(pair<int, int>(in[i], out[i]), i));
    ordByW.push_back(make_pair(pair<int, int>(out[i] - in[i], in[i]), i));
    ls.push_back(in[i]);
    ls.push_back(out[i]);
  }
  sort((ordByL).begin(), (ordByL).end());
  sort((ordByW).begin(), (ordByW).end());
  ls.push_back(0);
  ls.push_back(1001);
  sort((ls).begin(), (ls).end());
  ls.erase(unique((ls).begin(), (ls).end()), ls.end());
  ordByW.push_back(make_pair(pair<int, int>(0, 0), n));
  ordByL.push_back(make_pair(pair<int, int>(0, 0), n));
  in[n] = 0;
  out[n] = 1001;
  s[n] = lim;
  n++;
  for (int i = 0; i < (int)n; i++) {
    cmp[in[i]] = lower_bound((ls).begin(), (ls).end(), in[i]) - ls.begin();
    cmp[out[i]] = lower_bound((ls).begin(), (ls).end(), out[i]) - ls.begin();
  }
  int sid = 0;
  for (int ii = 0; ii < (int)n; ii++)
    for (int ww = 0; ww < (int)lim + 1; ww++) {
      int i = ordByW[ii].second;
      int mx = 0, next = 0;
      if (ww) dp[i][ww] = max(dp[i][ww], dp[i][ww - 1]);
      if (ww > s[i] || ww + w[i] > lim) continue;
      sid++;
      int k = 0;
      for (int jj = 0; jj < (int)n; jj++) {
        int j = ordByL[jj].second, l = cmp[in[j]];
        for (; k <= l; k++) {
          int t = stamp[k] == sid ? dp2[k] : 0;
          mx = max(mx, t);
        }
        if (i != j && in[i] <= in[j] && out[j] <= out[i]) {
          int r = cmp[out[j]];
          int t = mx + dp[j][ww];
          if (stamp[r] < sid || dp2[r] < t) {
            dp2[r] = t, stamp[r] = sid;
            next = max(next, t);
          }
        }
      }
      dp[i][ww + w[i]] = max(dp[i][ww + w[i]], next + v[i]);
    }
  cout << dp[n - 1][lim] << endl;
  return 0;
}
