#include <bits/stdc++.h>
using namespace std;
int n, s, f[505][1005], g[1005];
vector<pair<int, int> > p[1005];
struct parcel {
  int in, out, w, s, v;
} a[505];
int solve(int now, int s) {
  if (s < 0) return 0;
  if (f[now][s] != -1) return f[now][s];
  for (int i = 1; i <= n; i++)
    if ((i != now) && (a[i].in >= a[now].in) && (a[i].out <= a[now].out))
      solve(i, min(a[i].s, s - a[i].w));
  for (int i = a[now].in; i <= a[now].out; i++) {
    g[i] = 0;
    p[i].clear();
  }
  for (int i = 1; i <= n; i++)
    if ((i != now) && (a[i].in >= a[now].in) && (a[i].out <= a[now].out))
      p[a[i].out].push_back(
          make_pair(a[i].in, solve(i, min(a[i].s, s - a[i].w))));
  for (int i = a[now].in + 1; i <= a[now].out; i++) {
    g[i] = g[i - 1];
    for (int j = 0; j < p[i].size(); j++)
      g[i] = max(g[i], g[p[i][j].first] + p[i][j].second);
  }
  return f[now][s] = g[a[now].out] + a[now].v;
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d%d", &a[i].in, &a[i].out, &a[i].w, &a[i].s, &a[i].v);
    a[i].in++;
    a[i].out++;
  }
  a[++n] = (parcel){0, 2 * n + 1, 0, s, 0};
  memset(f, -1, sizeof(f));
  printf("%d\n", solve(n, s));
  return 0;
}
