#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
double EPS = 1e-7;
int INF = 1000000000;
long long INFLL = 1000000000000000000LL;
int mx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
int my[8] = {0, 0, -1, 1, -1, 1, -1, 1};
struct box {
  int in;
  int out;
  int w;
  int s;
  int v;
};
box x[505];
int jump[505];
bool cf(box a, box b) {
  if (a.in != b.in) return a.in < b.in;
  if (a.out != b.out) return a.out > b.out;
  return a.w < b.w;
}
int dp[1005][505];
int srt[505];
int n;
int maks[505];
int main() {
  int S;
  scanf("%d%d", &n, &S);
  for (int(a) = (1); (a) <= (n); (a)++) {
    scanf("%d%d%d%d%d", &x[a].in, &x[a].out, &x[a].w, &x[a].s, &x[a].v);
  }
  sort(x + 1, x + n + 1, cf);
  for (int(a) = (1); (a) <= (n); (a)++) {
    jump[a] = n + 1;
    for (int(b) = (1); (b) <= (n); (b)++) {
      if (x[b].in >= x[a].out) {
        jump[a] = b;
        break;
      }
    }
  }
  for (int(a) = (1); (a) <= (n); (a)++) {
    srt[a] = a;
  }
  for (int(a) = (1); (a) <= (n); (a)++) {
    int mins = a;
    for (int(c) = (a + 1); (c) <= (n); (c)++) {
      int b = srt[c];
      int b2 = srt[mins];
      if (x[b].out - x[b].in < x[b2].out - x[b2].in) {
        mins = c;
      }
    }
    swap(srt[a], srt[mins]);
  }
  srt[n + 1] = 0;
  x[0].out = INF;
  jump[n + 1] = n + 1;
  jump[0] = n + 1;
  for (int(str) = (0); (str) <= (S); (str)++) {
    for (int(pos2) = (1); (pos2) <= (n + 1); (pos2)++) {
      int pos = srt[pos2];
      for (int(it) = (pos + 1); (it) <= (jump[pos]); (it)++) {
        maks[it] = 0;
      }
      for (int(it) = (pos + 1); (it) <= (jump[pos] - 1); (it)++) {
        if (x[it].w <= str && x[it].out <= x[pos].out)
          maks[jump[it]] =
              max(maks[jump[it]],
                  maks[it] + x[it].v + dp[min(str - x[it].w, x[it].s)][it]);
        maks[it + 1] = max(maks[it + 1], maks[it]);
      }
      dp[str][pos] = maks[jump[pos]];
    }
  }
  printf("%d\n", dp[S][0]);
}
