#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1005;
int n, s;
struct Parcel {
  int l, r, w, s, v, id;
} a[N];
vector<Parcel> p[N];
ll dp[N][N];
ll dfs(int pos, int r) {
  if (dp[pos][r] != -1) return dp[pos][r];
  ll &ret = dp[pos][r];
  ret = 0;
  vector<ll> f(a[pos].r + 1);
  for (int i = a[pos].l; i <= a[pos].r; i++) {
    if (i) f[i] = f[i - 1];
    for (auto &j : p[i])
      if (j.l >= a[pos].l && j.w <= r && j.id != pos)
        f[i] = max(f[i], f[j.l] + j.v + dfs(j.id, min(j.s, r - j.w)));
  }
  return ret = f[a[pos].r];
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> s;
  for (int i = 1; i <= n; i++)
    cin >> a[i].l >> a[i].r >> a[i].w >> a[i].s >> a[i].v,
        a[i].id = i, p[a[i].r].push_back(a[i]);
  a[0].l = 0;
  a[0].r = 2 * n;
  memset(dp, -1, sizeof(dp));
  cout << dfs(0, s) << endl;
  return 0;
}
