#include <bits/stdc++.h>
using namespace std;
int s[510];
int w[510];
int v[510];
int in[510];
int out[510];
vector<int> a[1100];
int t1[510][1100];
int dp[510][1010];
int lvl = 0;
int get(int u, int s_max) {
  if (s_max < 0) return 0;
  if (s_max > s[u]) s_max = s[u];
  if (dp[u][s_max] >= 0) return dp[u][s_max];
  dp[u][s_max] = v[u];
  lvl++;
  int *t = t1[lvl];
  for (int i = in[u] - 1; i <= out[u]; i++) t[i] = 0;
  int res = 0;
  for (int i = in[u]; i <= out[u]; i++) {
    if (t[i - 1] > t[i]) t[i] = t[i - 1];
    if (t[i] > res) res = t[i];
    for (int j = 0; j < a[i].size(); j++) {
      int v = a[i][j];
      if (v == u) continue;
      if (out[v] > out[u]) continue;
      int r = get(v, s_max - w[v]) + t[i];
      if (t[out[v]] < r) t[out[v]] = r;
    }
  }
  dp[u][s_max] += res;
  lvl--;
  return dp[u][s_max];
}
int main() {
  int n;
  scanf("%d%d", &n, s);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= s[0]; j++) dp[i][j] = -1;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d%d", in + i, out + i, w + i, s + i, v + i);
    in[i] += 2;
    out[i] += 2;
  }
  in[0] = 1;
  out[0] = 2 * n + 5;
  for (int i = 1; i <= n; i++) a[in[i]].push_back(i);
  cout << get(0, int(1e9)) << endl;
  return 0;
}
