#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long int INFLL = 1e18 + 10;
const long double EPS = 1e-8;
const long double EPSLD = 1e-14;
const long long int MOD = 1e9 + 7;
template <class T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <class T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
const int MAX_N = 512;
struct par {
  int in, out, w, s, v;
  par() {}
  par(int in, int out, int w, int s, int v)
      : in(in), out(out), w(w), s(s), v(v) {}
  bool operator<(const par &a) const {
    if (a.out != out) return out < a.out;
    if (a.in != in) return in > a.in;
  }
};
int n, s;
par p[MAX_N];
int dp[MAX_N][MAX_N * 2];
int ans;
int main() {
  scanf("%d %d", &n, &s);
  for (int i = (0); i < (int)(n); i++)
    scanf("%d %d %d %d %d", &p[i].in, &p[i].out, &p[i].w, &p[i].s, &p[i].v);
  p[n++] = par(0, 2 * n, 0, s, 0);
  sort(p, p + n);
  for (int i = (0); i < (int)(n); i++)
    for (int j = (0); j < (int)(p[i].s + 1); j++) {
      vector<int> d(MAX_N * 2, 0);
      int q = 1;
      for (int k = (0); k < (int)(i); k++)
        if (p[i].in <= p[k].in && p[k].w <= j) {
          int r = min(j - p[k].w, p[k].s);
          while (q <= p[k].in) {
            chmax(d[q], d[q - 1]);
            q++;
          }
          chmax(d[p[k].out], d[p[k].in] + dp[k][r]);
        }
      while (q < MAX_N * 2) {
        chmax(d[q], d[q - 1]);
        q++;
      }
      dp[i][j] = d[q - 1] + p[i].v;
    }
  for (int i = (0); i < (int)(s + 1); i++) chmax(ans, dp[n - 1][i]);
  cout << ans << endl;
  return 0;
}
