#include <bits/stdc++.h>
using namespace std;
const int inft = 1000000009;
const int MAXN = 505, MAXS = 1003;
int dp[MAXN][MAXS];
int n, S;
int in[MAXN], out[MAXN], w[MAXN], s[MAXN], v[MAXN];
vector<int> E[2 * MAXN];
int get(int box, int wei) {
  int pocz = in[box], kon = out[box];
  vector<int> ans(kon - pocz + 1, 0);
  for (int i = 0; i < (kon - pocz + 1); ++i)
    if (i) {
      ans[i] = ans[i - 1];
      for (typeof((E[i + pocz]).begin()) it = (E[i + pocz]).begin();
           it != (E[i + pocz]).end(); ++it)
        if (*it != box) {
          int pp = in[*it];
          if (pp >= pocz) {
            int weight = min(s[*it], wei - w[*it]);
            if (weight >= 0)
              ans[i] = max(ans[i], ans[pp - pocz] + dp[*it][weight]);
          }
        }
    }
  return ans[kon - pocz];
}
void solve() {
  scanf("%d%d", &n, &S);
  in[0] = 0;
  out[0] = 2 * n;
  s[0] = S;
  w[0] = 0;
  v[0] = 0;
  vector<pair<int, int> > V;
  V.push_back(pair<int, int>(2 * n, 0));
  for (int i = 0; i < (n + 1); ++i)
    if (i) {
      scanf("%d%d%d%d%d", &in[i], &out[i], &w[i], &s[i], &v[i]);
      V.push_back(pair<int, int>(out[i] - in[i], i));
      E[out[i]].push_back(i);
    }
  sort(V.begin(), V.end());
  for (typeof((V).begin()) it = (V).begin(); it != (V).end(); ++it) {
    for (int i = 0; i < (s[it->second] + 1); ++i) {
      dp[it->second][i] = get(it->second, i) + v[it->second];
    }
  }
  printf("%d\n", dp[0][S]);
}
int main() {
  int t = 1;
  for (int i = 0; i < (t); ++i) solve();
  return 0;
}
