#include <bits/stdc++.h>
using namespace std;
int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
struct Qu {
  int l, r, w, s, v;
} q[510];
bool cmp(Qu x, Qu y) { return x.r == y.r ? x.l > y.l : x.r < y.r; }
int f[510][1010], n, S, g[510 << 1];
signed main() {
  n = read(), S = read();
  for (int i = 1; i <= n; i++)
    q[i] = (Qu){read(), read(), read(), read(), read()};
  q[n + 1] = (Qu){0, n << 1, 0, S, 0};
  sort(q + 1, q + 2 + n, cmp);
  for (int i = 1; i <= n + 1; i++)
    for (int k = S; k >= q[i].w; k--) {
      int l = q[i].l;
      g[q[i].l] = 0;
      for (int j = 1; j < i; j++)
        if (q[j].l >= q[i].l) {
          while (l < q[j].r) ++l, g[l] = g[l - 1];
          g[q[j].r] = max(g[q[j].r], g[q[j].l] + f[j][min(k - q[i].w, q[i].s)]);
        }
      f[i][k] = g[l] + q[i].v;
    }
  printf("%d\n", f[n + 1][S]);
  return 0;
}
