#include <bits/stdc++.h>
const int N = 1010;
using namespace std;
int read() {
  int x = 0, f = 1, c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
struct data {
  int in, out, w, s, v;
} p[N];
int f[N], dp[N][N], n, S;
bool cmp(data a, data b) {
  return a.out < b.out || (a.out == b.out && a.in > b.in);
}
int main() {
  n = read();
  S = read();
  for (int i = 1; i <= n; i++)
    p[i].in = read(), p[i].out = read(), p[i].w = read(), p[i].s = read(),
    p[i].v = read();
  p[0] = (data){0, n << 1, 0, S, 0};
  sort(p, p + 1 + n, cmp);
  for (int i = 0; i <= n; i++)
    for (int j = p[i].w; j <= S; j++) {
      int o = p[i].in;
      int wi = min(j - p[i].w, p[i].s);
      f[o] = 0;
      for (int k = 0; k < i; k++)
        if (p[k].in >= p[i].in) {
          while (o < p[k].out) f[++o] = f[o - 1];
          f[o] = max(f[o], f[p[k].in] + dp[k][wi]);
        }
      dp[i][j] = f[o] + p[i].v;
    }
  printf("%d", dp[n][S]);
}
