#include <bits/stdc++.h>
using namespace std;
int in[100001], out[100001], w[100001], s[100001], v[100001];
int ans[1001][1001];
vector<pair<int, int> > q;
int main() {
  int n, S;
  cin >> n >> S;
  for (int i = 0; i < n; i++) {
    cin >> in[i] >> out[i] >> w[i] >> s[i] >> v[i];
    q.push_back(make_pair(out[i], i));
  }
  sort(q.begin(), q.end());
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= S; j++) ans[i][j] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= s[i]; j++) ans[i][j] = v[i];
  for (int k = 0; k <= S; k++)
    for (int i = 0; i < n; i++)
      if (k <= s[i]) {
        if (k != 0) ans[i][k] = max(ans[i][k], ans[i][k - 1]);
        vector<int> p;
        for (int j = 0; j < n; j++)
          if (i != q[j].second && in[i] <= in[q[j].second] &&
              out[q[j].second] <= out[i] && k >= w[q[j].second])
            p.push_back(q[j].second);
        int dp[1001];
        for (int j = 0; j < 2 * n; j++) dp[j] = 0;
        int u = 0;
        for (int j = 1; j < 2 * n; j++) {
          dp[j] = max(dp[j - 1], dp[j]);
          while (u < int(p.size()) && out[p[u]] <= j)
            dp[out[p[u]]] =
                max(dp[out[p[u]]],
                    dp[in[p[u]]] + ans[p[u]][min(k - w[p[u]], s[p[u]])]),
            u++;
        }
        ans[i][k] = max(ans[i][k], dp[2 * n - 1] + v[i]);
      }
  int dp[1001];
  int u = 0;
  vector<int> p;
  for (int i = 0; i < n; i++) p.push_back(q[i].second);
  for (int i = 0; i < 2 * n; i++) dp[i] = 0;
  for (int i = 1; i < 2 * n; i++) {
    dp[i] = max(dp[i], dp[i - 1]);
    while (u < int(p.size()) && out[p[u]] <= i) {
      for (int j = 0; j <= min(S - w[p[u]], s[p[u]]); j++)
        dp[out[p[u]]] = max(dp[out[p[u]]], dp[in[p[u]]] + ans[p[u]][j]);
      u++;
    }
  }
  cout << dp[2 * n - 1] << endl;
  return 0;
}
