#include <bits/stdc++.h>
using namespace std;
int in[501], out[501], str[501], wi[501], val[501];
vector<pair<int, int>> adj[501];
int dp[501][1004];
vector<int> l[501];
int dfs(int x, int s) {
  if (s < 0) return 0;
  if (dp[x][s] != -1) return dp[x][s];
  dp[x][s] = val[x];
  int omar = adj[x].size();
  vector<int> tmp;
  tmp.assign(omar + 1, 0);
  for (int i = 0; i < omar; ++i) {
    int me = adj[x][i].second;
    int yeah = 0;
    if (wi[me] <= s) yeah = dfs(me, min(str[me], s - wi[me]));
    tmp[i] = max(tmp[i], yeah);
    if (l[x][i] != i) tmp[i] = max(tmp[i], yeah + tmp[l[x][i]]);
    tmp[i + 1] = tmp[i];
  }
  return dp[x][s] = max(val[x] + tmp[omar], 0);
}
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  val[0] = 0;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; ++i)
    scanf("%d%d%d%d%d", &in[i], &out[i], &wi[i], &str[i], &val[i]),
        adj[0].push_back(make_pair(out[i], i));
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (in[i] <= in[j] && out[j] <= out[i] && i != j)
        adj[i].push_back(make_pair(out[j], j));
  for (int i = 0; i <= n; ++i) sort(adj[i].begin(), adj[i].end());
  for (int x = 0; x <= n; ++x) {
    for (int i = 0; i < adj[x].size(); ++i) {
      l[x].push_back(i);
      int me = adj[x][i].second;
      for (int j = 0; j < i; ++j)
        if (adj[x][j].first <= in[me]) l[x][i] = j;
    }
  }
  cout << dfs(0, s) << endl;
}
