#include <bits/stdc++.h>
using namespace std;
const int maxn = 508, maxs = 1008;
int n, S, f[maxn][maxs], g[maxn][maxs];
vector<int> V[maxn];
struct Element {
  int in, out, w, s, v;
  inline bool operator<(const Element u) const {
    return in == u.in ? out > u.out : in < u.in;
  }
  inline void Input() { scanf("%d%d%d%d%d", &in, &out, &w, &s, &v); }
} e[maxn];
int Calc(int u, int rs) {
  if (f[u][rs] != -1) return f[u][rs];
  memset(g[u], 0, sizeof g[u]);
  for (int i = 0, j = max(e[u].in, 0); j <= e[u].out; j++) {
    while (i < V[u].size() && e[V[u][i]].in < j) i++;
    for (; i < V[u].size() && e[V[u][i]].in == j; i++) {
      int v = V[u][i], out = e[v].out;
      if (e[v].w <= rs)
        g[u][out] = max(g[u][out], g[u][j] + Calc(v, min(rs - e[v].w, e[v].s)));
    }
    g[u][j + 1] = max(g[u][j], g[u][j + 1]);
  }
  return f[u][rs] = (g[u][e[u].out] + e[u].v);
}
int main() {
  scanf("%d%d", &n, &S);
  for (int i = 0; i < n; i++) e[i].Input();
  e[n].in = -1;
  e[n].out = n << 1;
  e[n].w = 0;
  e[n].s = S;
  e[n].v = 0;
  sort(e, e + n + 1);
  for (int i = 0; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (e[j].out <= e[i].out) V[i].push_back(j);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= S; j++) f[i][j] = -1;
  printf("%d\n", Calc(0, S));
  return 0;
}
