#include <bits/stdc++.h>
using namespace std;
int n;
int dp[1010][1010], w[1010], cap[1010], in[1010], out[1010], val[1010], f[1010];
vector<pair<int, int> > v[1010];
void su(int &a, int b) { a = max(a, b); }
int solve(int i, int s) {
  if (dp[i][s] != -1) return dp[i][s];
  for (int k = (1); k <= (n); k++)
    if (k != i && in[i] <= in[k] && out[k] <= out[i] && s >= w[k])
      solve(k, min(cap[k], s - w[k]));
  for (int k = (in[i]); k <= (out[i]); k++) f[k] = 0, v[k].clear();
  for (int k = (1); k <= (n); k++)
    if (k != i && in[i] <= in[k] && out[k] <= out[i] && s >= w[k])
      v[out[k]].push_back(make_pair(in[k], solve(k, min(cap[k], s - w[k]))));
  for (int k = (in[i] + 1); k <= (out[i]); k++) {
    f[k] = f[k - 1];
    for (typeof((v[k]).begin()) it = (v[k]).begin(); it != (v[k]).end(); it++)
      su(f[k], f[it->first] + it->second);
  }
  dp[i][s] = f[out[i]] + val[i];
  return dp[i][s];
}
void lemon() {
  int S;
  scanf("%d%d", &n, &S);
  for (int i = (1); i <= (n); i++)
    scanf("%d%d%d%d%d", &in[i], &out[i], &w[i], &cap[i], &val[i]), in[i]++,
        out[i]++;
  n++;
  in[n] = 0;
  out[n] = 2 * n + 1;
  memset(dp, 255, sizeof dp);
  int final = 0;
  final = solve(n, S);
  printf("%d\n", final);
}
int main() {
  ios::sync_with_stdio(true);
  lemon();
  return 0;
}
