#include <bits/stdc++.h>
using namespace std;
const int oo = 2000000009;
const double eps = 1e-9;
const int mx = 502;
struct Box {
 public:
  int w, s, v, in, out;
  Box() {}
  Box(int _dummy) { scanf("%d %d %d %d %d", &in, &out, &w, &s, &v); }
  bool operator<(const Box &b) const {
    if (b.in == in) return out > b.out;
    return in < b.in;
  }
} boxes[mx];
int n, S;
int dp[mx][mx], dp2[mx][2 * mx];
int nxt[mx];
int solve(int l, int i, int s) {
  if (i == n + 1) return 0;
  if (boxes[l].out <= boxes[i].in) return 0;
  int ret = 0;
  ret = dp[l][i + 1];
  if (boxes[i].w <= s && boxes[i].out <= boxes[l].out) {
    int sd = min(s - boxes[i].w, boxes[i].s);
    ret = max(ret, boxes[i].v + dp2[i][sd] + dp[l][nxt[i]]);
  }
  return ret;
}
int main() {
  scanf("%d %d", &n, &S);
  boxes[0].s = S;
  boxes[0].in = -oo;
  boxes[0].out = oo;
  for (int i = 1; i <= (n); ++i) boxes[i] = Box(-1);
  boxes[n + 1].in = oo;
  boxes[n + 1].out = -oo;
  sort(boxes + 1, boxes + n + 1);
  for (int i = 1; i <= (n); ++i) {
    nxt[i] = n + 1;
    for (int j = i + 1; j <= (n); ++j)
      if (boxes[j].in >= boxes[i].out) {
        nxt[i] = j;
        break;
      }
  }
  for (int s = 0; s <= S; s++) {
    for (int l = n; l >= 0; --l) {
      for (int i = n; i > l; --i) {
        dp[l][i] = solve(l, i, s);
      }
      dp2[l][s] = dp[l][l + 1];
    }
  }
  printf("%d\n", dp[0][1]);
  return 0;
}
