#include <bits/stdc++.h>
using namespace std;
const int DEBUG = 0;
namespace defs {
int read() {
  int aa, bb = 1, ch;
  while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-')
    ;
  ch == '-' ? aa = 0, bb = -1 : aa = ch - '0';
  while (ch = getchar(), ch >= '0' && ch <= '9') aa = aa * 10 + ch - '0';
  return aa * bb;
}
const unsigned int rand_x = 1401010315;
const unsigned int rand_y = 1000000019;
unsigned int rand_cur;
unsigned int rand_int() { return rand_cur = rand_cur * rand_x + rand_y; }
const int inf = 1071026353;
const int mod = 1000000007;
const int modx = 998244353;
const int maxn = 1010;
}  // namespace defs
namespace lightningwork {
using namespace defs;
struct P {
  int l, r, w, s, v;
} p[maxn];
bool cmp(const P &a, const P &b) {
  return a.l < b.l || (a.l == b.l && a.r > b.r);
}
int n, s;
int dp[maxn][maxn];
int f[maxn][maxn], mx[maxn];
int solve(int now) {
  memset(mx, 0, sizeof mx);
  int j = p[now].l;
  for (int i = now + 1; i <= n; ++i) {
    if (p[i].l > p[now].r) break;
    while (j <= p[i].l) {
      for (int k = 0; k <= s; ++k) {
        (mx[k] < (f[j][k]) ? mx[k] = f[j][k] : 0);
        f[j][k] = 0;
      }
      ++j;
    }
    if (p[i].r <= p[now].r) {
      for (int k = p[now].w; k <= s; ++k) {
        int t = ((p[now].s) < (k - p[now].w) ? (p[now].s) : (k - p[now].w));
        (f[p[i].r][k] < (mx[k] + dp[i][t]) ? f[p[i].r][k] = mx[k] + dp[i][t]
                                           : 0);
      }
    }
  }
  while (j <= p[now].r) {
    for (int k = 0; k <= s; ++k) {
      (mx[k] < (f[j][k]) ? mx[k] = f[j][k] : 0);
      f[j][k] = 0;
    }
    ++j;
  }
  int tmp = 0;
  for (int i = p[now].w; i <= s; ++i) {
    (tmp < (mx[i] + p[now].v) ? tmp = mx[i] + p[now].v : 0);
    dp[now][i] = tmp;
  }
  return dp[now][s];
}
void work() {
  n = read();
  p[0] = (P){0, n * 2, 0, s = read(), 0};
  for (int i = 1; i <= n; ++i) {
    p[i].l = read();
    p[i].r = read();
    p[i].w = read();
    p[i].s = read();
    p[i].v = read();
  }
  sort(p, p + n + 1, cmp);
  for (int i = n; i >= 1; --i) solve(i);
  printf("%d\n", solve(0));
}
}  // namespace lightningwork
int main() {
  if (0)
    freopen(
        "parcels"
        ".in",
        "r", stdin),
        freopen(
            "parcels"
            ".out",
            "w", stdout);
  lightningwork::work();
  if (0) fclose(stdin), fclose(stdout);
  return 0;
}
