#include <bits/stdc++.h>
using namespace std;
int dp[505][1005];
int f[1005];
struct node {
  int l, r, w, s, v;
  void in() { scanf("%d%d%d%d%d", &l, &r, &w, &s, &v); }
} a[1005];
bool cmp(node a, node b) { return a.r < b.r || (a.r == b.r && a.l > b.l); }
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; ++i) a[i].in();
  a[n].l = 0, a[n].r = n * 2, a[n].w = a[n].v = 0, a[n].s = s;
  sort(a, a + n + 1, cmp);
  for (int i = 0; i <= n; ++i) {
    for (int j = a[i].w; j <= s; ++j) {
      int w = ((j - a[i].w) < (a[i].s) ? (j - a[i].w) : (a[i].s));
      int now = a[i].l;
      f[now] = 0;
      for (int k = 0; k < i; ++k) {
        if (a[k].l >= a[i].l) {
          while (now < a[k].r) {
            now++;
            f[now] = f[now - 1];
          }
          f[now] = ((f[now]) > (f[a[k].l] + dp[k][w]) ? (f[now])
                                                      : (f[a[k].l] + dp[k][w]));
        }
      }
      dp[i][j] = f[now] + a[i].v;
    }
  }
  printf("%d\n", dp[n][s]);
  return 0;
}
