#include <bits/stdc++.h>
using namespace std;
const int N = 509, S = 1009;
struct par {
  int l, r, w, s, v, ind;
  par(int _l, int _r, int _w, int _s, int _v, int _ind = 0) {
    l = _l, r = _r, w = _w, s = _s, v = _v, ind = _ind;
  }
  par() {}
  bool operator<(par b) const { return (l == b.l ? r > b.r : l < b.l); }
} p[N];
vector<par> v[N];
vector<int> sh[N];
int dp[N][S], n, s, o[N], tmp[N], res;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> s;
  p[0].l = 0, p[0].r = 2 * n, p[0].w = 0, p[0].s = s, p[0].v = 0, n++;
  for (int i = 1, l, r, w, s, v; i < n; i++)
    cin >> l >> r >> w >> s >> v, p[i] = {l, r, w, s, v};
  sort(p, p + n);
  for (int i = 0; i < n; i++) p[i].ind = i;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (p[j].r <= p[i].r) v[i].push_back(p[j]), sh[i].push_back(p[j].l);
  for (int j = 0; j <= s; j++)
    for (int i = n - 1; i >= 0; i--) {
      memset(tmp, 0, sizeof tmp);
      for (int k = v[i].size() - 1; k >= 0; k--) {
        tmp[k] = tmp[k + 1];
        if (j >= v[i][k].w) {
          int p1 = lower_bound(sh[i].begin(), sh[i].end(), v[i][k].r) -
                   sh[i].begin();
          tmp[k] =
              max(tmp[k], v[i][k].v +
                              dp[v[i][k].ind][min(j - v[i][k].w, v[i][k].s)] +
                              tmp[p1]);
        }
      }
      dp[i][j] = tmp[0];
    }
  cout << dp[0][s];
}
