#include <bits/stdc++.h>
using namespace std;
const int maxn = 505;
const int maxs = 1005;
struct NODE {
  int in, out, w, s, v;
  bool operator<(const NODE& rhs) const {
    if (in != rhs.in) return in < rhs.in;
    return out > rhs.out;
  }
  void read() { scanf("%d%d%d%d%d", &in, &out, &w, &s, &v); }
} a[maxn];
int n, S;
int dp[maxn][maxs], v[maxs];
vector<int> e[maxs];
int main() {
  scanf("%d%d", &n, &S);
  a[0].in = 0;
  a[0].out = n * 2;
  a[0].w = 0;
  a[0].s = S;
  a[0].v = 0;
  for (int i = 1; i <= n; i++) a[i].read();
  sort(a, a + n + 1);
  for (int i = 0; i <= n * 2; i++) e[i].clear();
  for (int i = 1; i <= n; i++) e[a[i].in].push_back(i);
  memset(dp, 0, sizeof(dp));
  for (int i = n; i >= 0; i--) {
    for (int j = a[i].w; j <= S && j <= a[i].w + a[i].s; j++) {
      memset(v, 0, sizeof(v));
      for (int x = a[i].in; x < a[i].out; x++) {
        v[x + 1] = max(v[x + 1], v[x]);
        for (int k = 0; k < (int)e[x].size(); k++) {
          int l = e[x][k];
          if (a[l].out > a[i].out || l == i) continue;
          v[a[l].out] = max(v[a[l].out], v[x] + dp[l][j - a[i].w]);
        }
      }
      dp[i][j] = v[a[i].out] + a[i].v;
    }
    for (int j = 1; j <= S; j++) dp[i][j] = max(dp[i][j], dp[i][j - 1]);
  }
  printf("%d\n", dp[0][S]);
}
