#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
inline int getBit(long long x, int pos) { return ((x >> pos) & 1); }
const double eps = 1e-9;
const double pi = acos(-1.0);
int n;
int dp[550][1050];
int dp2[1050];
vector<int> g[550];
int tin[550], tout[550], w[550], s[550], v[550];
bool cmp(int i, int j) { return tout[i] < tout[j]; }
void update(int pos, int val) {
  for (; pos < 2 * n; pos++) {
    dp2[pos] = max(dp2[pos], val);
  }
}
int getMx(int pos) {
  int res = 0;
  while (pos >= 0) {
    res = max(res, dp2[pos]);
    pos &= (pos + 1);
    pos--;
  }
  return res;
}
int go(int i, int ss) {
  if (dp[i][ss] != -1) return dp[i][ss];
  int &res = dp[i][ss];
  res = v[i];
  vector<pair<int, int> > a;
  for (int j = 0; j < ((int)(g[i]).size()); j++) {
    int id = g[i][j];
    if (ss >= w[id]) {
      go(id, min(ss - w[id], s[id]));
      a.push_back(make_pair(id, min(ss - w[id], s[id])));
    }
  }
  for (int j = 0; j < 2 * n; j++) {
    dp2[j] = 0;
  }
  for (int j = 0; j < ((int)(a).size()); j++) {
    dp2[tout[a[j].first]] =
        max(dp2[tout[a[j].first]],
            getMx(tin[a[j].first]) + dp[a[j].first][a[j].second]);
    update(tout[a[j].first], dp2[tout[a[j].first]]);
  }
  res += getMx(2 * n - 1);
  return res;
}
int main() {
  scanf("%d%d", &n, &s[0]);
  tin[0] = -1;
  tout[0] = 2 * n;
  v[0] = 0;
  w[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d%d", &tin[i], &tout[i], &w[i], &s[i], &v[i]);
  }
  n++;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j && tin[i] <= tin[j] && tout[j] <= tout[i]) {
        g[i].push_back(j);
      }
    }
    sort(g[i].begin(), g[i].end(), cmp);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s[0]; j++) {
      dp[i][j] = -1;
    }
  }
  printf("%d\n", go(0, s[0]));
  return 0;
}
