#include <bits/stdc++.h>
using namespace std;
struct box {
  int st, end, w, str, v;
  bool operator<(const box &oth) const {
    return st < oth.st || (st == oth.st && end > oth.end);
  }
} bs[505];
vector<pair<pair<int, int>, int> > ev[505];
long long cch[505][1010];
char sn[505][1010];
int n, s;
long long dp(int at, int str) {
  long long ccch[n];
  if (str < bs[at].w) return 0;
  if (sn[at][str]) return cch[at][str];
  sn[at][str] = 1;
  long long run = bs[at].v;
  for (int i = 0; i < ev[at].size(); i++) {
    int cur = ev[at][i].second;
    if (ev[at][i].first.second == 0)
      run = max(run, ccch[cur]);
    else
      ccch[cur] = run + dp(cur, min(str - bs[at].w, bs[at].str));
  }
  return cch[at][str] = run;
}
int main() {
  scanf("%d %d", &n, &s);
  n++;
  bs[0].st = 0;
  bs[0].end = 10 * n;
  bs[0].str = s;
  for (int i = 1; i < n; i++)
    scanf("%d %d %d %d %d", &bs[i].st, &bs[i].end, &bs[i].w, &bs[i].str,
          &bs[i].v);
  sort(bs, bs + n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++)
      if (bs[j].end <= bs[i].end) {
        ev[i].push_back(make_pair(make_pair(bs[j].st, 1), j));
        ev[i].push_back(make_pair(make_pair(bs[j].end, 0), j));
      }
    sort(ev[i].begin(), ev[i].end());
  }
  printf("%lld\n", dp(0, s));
  return 0;
}
