#include <bits/stdc++.h>
using namespace std;
inline int qr() {
  int sum = 0, f = 1;
  char a;
  a = getchar();
  while (!isdigit(a)) {
    if (a == '-') f = -1;
    a = getchar();
  }
  while (isdigit(a)) {
    sum = (sum << 3) + (sum << 1) + (48 ^ a);
    a = getchar();
  }
  return sum;
}
const int N = 1005;
int n, S;
struct ob {
  int in, out, w, v, s;
} th[N];
bool cmpp(ob aa, ob bb) {
  if (aa.out == bb.out) return aa.in > bb.in;
  return aa.out < bb.out;
}
int f[N][N], g[N];
signed main() {
  n = qr(), S = qr();
  for (int i = 1; i <= n; ++i) {
    th[i].in = qr();
    th[i].out = qr();
    th[i].w = qr(), th[i].s = qr(), th[i].v = qr();
  }
  sort(th + 1, th + n + 1, cmpp);
  th[n + 1].in = 0;
  th[n + 1].out = 2 * n + 1;
  th[n + 1].w = 0, th[n + 1].s = S, th[n + 1].v = 0;
  for (int i = 1; i <= n + 1; ++i) {
    for (int k = th[i].w; k <= S; ++k) {
      int l = th[i].in;
      g[l] = 0;
      for (int j = 1; j < i; ++j) {
        if (th[j].in >= th[i].in) {
          while (l < th[j].out) g[++l] = g[l - 1];
          g[l] = max(g[l], g[th[j].in] + f[j][min(k - th[i].w, th[i].s)]);
        }
      }
      f[i][k] = g[l] + th[i].v;
    }
  }
  cout << f[n + 1][S] << endl;
}
