#include <bits/stdc++.h>
using namespace std;
struct box {
  int in, out, w, s, v;
} inp[600];
int dp1[600][1005] = {{0}};
int dp2[1005];
inline bool cc1(const box &a, const box &b) {
  return a.out < b.out || a.out == b.out && a.in > b.in;
}
int main() {
  int i, j, k, l, n, S;
  scanf("%d", &n), scanf("%d", &S);
  inp[0] = (box){0, 2 * n + 1, 0, S, 0};
  for (int i = 1; i <= n; i++)
    scanf("%d", &inp[i].in), scanf("%d", &inp[i].out), scanf("%d", &inp[i].w),
        scanf("%d", &inp[i].s), scanf("%d", &inp[i].v);
  sort(inp, inp + n + 1, cc1);
  for (int i = 0; i <= n + 1 - 1; i++) {
    k = min(inp[i].s + inp[i].w, S);
    vector<int> sub;
    for (int j = 0; j <= i; j++) {
      if (inp[j].in >= inp[i].in) sub.push_back(j);
    }
    l = sub.size();
    for (int j = inp[i].w; j <= k; j++) {
      memset(dp2, 0, sizeof(dp2));
      int p, q, r, t;
      for (int p = 0; p <= l - 1 - 1; p++) {
        q = sub[p], r = sub[p + 1];
        dp2[inp[q].out] =
            max(dp2[inp[q].out], dp2[inp[q].in] + dp1[q][j - inp[i].w]);
        for (int t = inp[q].out; t <= inp[r].out; t++) dp2[t] = dp2[inp[q].out];
      }
      dp1[i][j] = dp2[inp[i].out] + inp[i].v;
    }
    for (int j = k + 1; j <= S; j++) dp1[i][j] = dp1[i][j - 1];
  }
  printf("%d\n", dp1[n][S]);
}
