#include <bits/stdc++.h>
using namespace std;
inline int lowbit(int x) { return x & -x; }
inline int ABS(int x) { return x < 0 ? -x : x; }
inline long long ABS(long long x) { return x < 0 ? -x : x; }
inline void MAX(int &a, int b) {
  if (b > a) a = b;
}
inline void MAX(long long &a, long long b) {
  if (b > a) a = b;
}
inline void MIN(int &a, int b) {
  if (b < a) a = b;
}
inline void MIN(long long &a, long long b) {
  if (b < a) a = b;
}
int fast(int x, int v) {
  int ans = 1;
  for (; v; v >>= 1, x = (long long)x * x % 1000000007)
    if (v & 1) ans = (long long)ans * x % 1000000007;
  return ans;
}
long long fast(long long x, long long v) {
  long long ans = 1;
  for (; v; v >>= 1, x = x * x % 1000000007)
    if (v & 1) ans = ans * x % 1000000007;
  return ans;
}
inline long long sqr(int x) { return x * x; }
struct parcel {
  int in, out, w, s, v;
  inline void read() { scanf("%d%d%d%d%d", &in, &out, &w, &s, &v); }
} a[505];
inline bool cmp1(const parcel &a, const parcel &b) {
  if (a.in ^ b.in) return a.in > b.in;
  return a.out < b.out;
}
int n, s, f[505][1005], g[1005], nx[505];
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; ++i) a[i].read();
  sort(a + 1, a + 1 + n, cmp1);
  a[++n].in = 1, a[n].out = 2 * (n - 1), a[n].s = s;
  for (int i = n; i >= 1; --i)
    for (int j = i - 1; j >= 1; --j)
      if (a[i].out <= a[j].in) {
        nx[i] = j;
        break;
      }
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= a[i].s; ++j) {
      memset(g, 0, sizeof(g));
      int Max = 0;
      for (int k = i - 1; k >= 1; --k) {
        MAX(g[k - 1], g[k]);
        if (a[k].out > a[i].out) continue;
        if (j - a[k].w >= 0)
          MAX(Max, g[k] + f[k][min(j - a[k].w, a[k].s)]);
        else
          MAX(Max, g[k]);
        if (j - a[k].w >= 0)
          MAX(g[nx[k]], g[k] + f[k][min(j - a[k].w, a[k].s)]);
      }
      f[i][j] = Max + a[i].v;
    }
  printf("%d\n", f[n][s]);
}
