#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, m, g[N * 2];
int f[N][N * 2];
struct node {
  int l, r, w, s, v;
} a[N];
bool cmp(node a, node b) { return a.r == b.r ? a.l > b.l : a.r < b.r; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(n); i++)
    scanf("%d%d%d%d%d", &a[i].l, &a[i].r, &a[i].w, &a[i].s, &a[i].v);
  sort(a + 1, a + n + 1, cmp);
  a[n + 1].l = 0;
  a[n + 1].r = n * 2;
  a[n + 1].s = m;
  for (int i = (int)(1); i <= (int)(n + 1); i++)
    for (int j = (int)(a[i].w); j <= (int)(m); j++) {
      int p = a[i].l;
      g[p] = 0;
      for (int k = (int)(1); k <= (int)(i - 1); k++)
        if (a[k].l >= a[i].l) {
          for (; p < a[k].r;) p++, g[p] = g[p - 1];
          g[p] = max(g[p], g[a[k].l] + f[k][min(j - a[i].w, a[i].s)]);
        }
      f[i][j] = g[p] + a[i].v;
    }
  printf("%d ", f[n + 1][m]);
}
