#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct S {
  int in, out, w, s, v;
  bool operator<(const S &rhs) const {
    if (in != rhs.in) return in < rhs.in;
    return out > rhs.out;
  }
};
S b[501];
int s, n, dp[502][1002], DP[1002];
vector<int> g[502];
vector<pair<int, int> > bx[1002];
int calc(int idx, int rem) {
  int &ret = dp[idx][rem];
  if (ret != -1) return ret;
  for (auto v : g[idx])
    if (rem >= b[v].w) calc(v, min(rem - b[v].w, b[v].s));
  for (int i = b[idx].in; i <= b[idx].out; ++i) bx[i].clear();
  for (auto v : g[idx]) {
    if (rem >= b[v].w) {
      bx[b[v].in].push_back(
          make_pair(b[v].out, b[v].v + calc(v, min(rem - b[v].w, b[v].s))));
    }
  }
  for (int i = 0; i <= 2 * n; ++i) DP[i] = 0;
  for (int i = b[idx].out; i >= b[idx].in; --i) {
    DP[i] = DP[i + 1];
    for (auto v : bx[i]) DP[i] = max(DP[i], v.second + DP[v.first]);
  }
  return ret = DP[b[idx].in];
}
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d%d%d%d", &b[i].in, &b[i].out, &b[i].w, &b[i].s, &b[i].v);
  }
  b[0].in = -1;
  b[0].out = 2 * n + 1;
  sort(b + 1, b + n + 1);
  for (int i = 0; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (b[j].in >= b[i].in && b[j].out <= b[i].out) {
        g[i].push_back(j);
      }
  memset(dp, -1, sizeof dp);
  printf("%d\n", calc(0, s));
  return 0;
}
