#include <bits/stdc++.h>
using namespace std;
const int N(505);
struct hh {
  int in, out, w, s, v;
  bool operator<(const hh &b) const {
    if (in != b.in) return in < b.in;
    return out > b.out;
  }
} a[N];
int n, S;
int f[N << 1][N << 1];
int dp[N << 1];
inline void read(int &x) {
  char c = 0;
  int flag = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') flag = -1;
  for (x = 0; c >= '0' && c <= '9'; c = getchar()) (x *= 10) += (c - '0');
  x *= flag;
}
inline void update(int &a, int b) { a = max(a, b); }
int main() {
  read(n);
  read(S);
  for (int i(1); i <= n; i++)
    read(a[i].in), read(a[i].out), read(a[i].w), read(a[i].s), read(a[i].v);
  sort(a + 1, a + n + 1);
  a[0].in = 0;
  a[0].out = (n << 1);
  a[0].w = 0;
  a[0].s = S;
  a[0].v = 0;
  for (int i(n); i >= 0; i--) {
    if (a[i].w > S) continue;
    for (int s(0); s <= a[i].s; s++) {
      memset(dp, 0, sizeof(dp));
      int maxx = dp[0] = a[i].v;
      for (int j(i + 1), x(0); j <= n; j++) {
        if (a[j].in >= a[i].out) break;
        if (a[j].out > a[i].out) continue;
        for (; x < a[j].in; x++) dp[x + 1] = max(dp[x + 1], dp[x]);
        if (a[j].w <= s)
          dp[a[j].out] =
              max(dp[a[j].out], dp[a[j].in] + f[j][min(a[j].s, s - a[j].w)]),
          maxx = max(maxx, dp[a[j].out]);
      }
      f[i][s] = max(f[i][s], maxx);
    }
  }
  cout << f[0][S] << endl;
  return 0;
}
