#include <bits/stdc++.h>
using namespace std;
struct ww {
  int l, r, w, s, v;
} a[1010];
int i, j, k, n, m, u;
int f[510][1010], h[1010][1010];
inline bool cc1(const ww &a, const ww &b) {
  return a.r < b.r || a.r == b.r && a.l > b.l;
}
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++)
    scanf("%d%d%d%d%d", &a[i].l, &a[i].r, &a[i].w, &a[i].s, &a[i].v);
  a[0] = (ww){0, n * 2 + 1, 0, m, 0};
  sort(a, a + n + 1, cc1);
  for (i = 0; i <= n; i++) {
    int t = min(a[i].s, m - a[i].w);
    memset(h, 0, sizeof(h));
    for (j = 0; a[j].r <= a[i].l; j++)
      ;
    for (k = a[i].l + 1; k <= a[i].r; k++) {
      memcpy(h[k], h[k - 1], sizeof(h[k]));
      for (; j < i && a[j].r == k; j++) {
        int A = a[j].l;
        if (A < a[i].l) continue;
        for (u = 0; u <= t; u++) h[k][u] = max(h[k][u], h[A][u] + f[j][u]);
      }
    }
    for (u = 0; u <= t; u++) f[i][u + a[i].w] = h[a[i].r][u] + a[i].v;
    for (u = 1; u <= m; u++) f[i][u] = max(f[i][u], f[i][u - 1]);
  }
  printf("%d\n", f[n][m]);
  return 0;
}
