#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
const int inf = 0x3f3f3f3f;
const long double pi = acos(-1.0);
const string debug_line = "yolo";
const double PI = 4 * atan(1);
typedef struct node2 {
  int in;
  int out;
  int w;
  int s;
  int v;
  int index;
  friend bool operator<(const node2 a, const node2 b) {
    if (a.out != b.out) {
      return a.out < b.out;
    } else {
      return a.in > b.in;
    }
  }
} segment;
vector<segment> v1;
stack<segment> s1;
int dp[501][1010];
int pa[1010];
vector<int> Adj[510];
bool visited[501];
vector<pair<pair<int, int>, int> > v2;
vector<segment> temp;
void DFS(int u, int p) {
  visited[u] = true;
  for (auto &(t1) : (Adj[u])) {
    if (!visited[t1] && t1 != p) {
      DFS(t1, u);
    }
  }
  return;
}
int main() {
  int n, S;
  scanf("%d%d", &n, &S);
  segment origin = {0, 2 * n, 0, S, 0, 0};
  v1.push_back(origin);
  for (int(i) = (1); (i) < (n + 1); ++(i)) {
    int in, out, w, s, v;
    scanf("%d%d%d%d%d", &in, &out, &w, &s, &v);
    v1.push_back({in, out, w, s, v, i});
  }
  sort(v1.begin(), v1.end());
  for (int(i) = (0); (i) < (n + 1); ++(i)) {
    for (int(j) = (v1[i].w); (j) < (S + 1); ++(j)) {
      int remain = min(j - v1[i].w, v1[i].s);
      int current = v1[i].in;
      pa[current] = 0;
      memset(pa, 0, sizeof(pa));
      for (int(k) = (0); (k) < (i); ++(k)) {
        if (v1[k].in >= v1[i].in) {
          while (current < v1[k].out) {
            current++;
            pa[current] = pa[current - 1];
          }
          pa[current] = max(pa[current], pa[v1[k].in] + dp[k][remain]);
        }
      }
      dp[i][j] = v1[i].v + pa[current];
    }
  }
  printf("%d\n", dp[n][S]);
  return 0;
}
