#include <bits/stdc++.h>
using namespace std;
const int N = 505, S = 1005;
int n, s, f[N][S], g[2 * N];
struct parcel {
  int in, out, w, s, v;
  void read() { scanf("%d%d%d%d%d", &in, &out, &w, &s, &v); }
} a[N];
inline bool cmp(const parcel &a, const parcel &b) {
  return a.out < b.out || a.out == b.out && a.in > b.in;
}
int main() {
  scanf("%d%d", &n, &s);
  a[0] = (parcel){0, 2 * n, 0, s, 0};
  for (int i = 1; i <= n; i++) a[i].read();
  sort(a, a + n + 1, cmp);
  for (int i = 0; i <= n; i++)
    for (int k = a[i].w; k <= s; k++) {
      int o = a[i].in;
      g[o] = 0;
      int kk = min(k - a[i].w, a[i].s);
      for (int j = 0; j < i; j++)
        if (a[j].in >= a[i].in) {
          while (o < a[j].out) {
            ++o;
            g[o] = g[o - 1];
          }
          g[o] = max(g[o], g[a[j].in] + f[j][kk]);
        }
      f[i][k] = g[o] + a[i].v;
    }
  printf("%d\n", f[n][s]);
}
