#include <bits/stdc++.h>
using namespace std;
struct oo {
  int l, r, w, s, v;
  void input() { scanf("%d%d%d%d%d", &l, &r, &w, &s, &v); }
  bool operator<(const oo& p) const { return r < p.r || (r == p.r && l > p.l); }
} a[512];
int n, s, f[512][1024], g[1024];
void solve() {
  a[0] = (oo){0, n * 2, 0, s, 0};
  for (int i = 1; i <= n; ++i) a[i].input();
  sort(a, a + n + 1);
  for (int i = 0; i <= n; ++i)
    for (int j = a[i].w; j <= s; ++j) {
      int o = a[i].l;
      g[o] = 0;
      int jj = min(j - a[i].w, a[i].s);
      for (int k = 0; k < i; ++k)
        if (a[k].l >= a[i].l) {
          while (o < a[k].r) ++o, g[o] = g[o - 1];
          g[o] = max(g[o], g[a[k].l] + f[k][jj]);
        }
      f[i][j] = g[o] + a[i].v;
    }
  cout << f[n][s] << endl;
}
int main() {
  while (scanf("%d%d", &n, &s) != EOF) {
    solve();
  }
}
