#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int dp[MAXN][MAXN];
int dp2[MAXN][MAXN];
int ind[MAXN], ne[MAXN];
int n;
struct parcel {
  int in, out, we, str, val;
} arr[MAXN];
bool cmp(parcel a, parcel b) {
  if (a.in == b.in) {
    return a.out > b.out;
  }
  return a.in < b.in;
}
int rek(int x, int s) {
  if (s < 0) return -1e9;
  if (x == n) return 0;
  if (dp[x][s] != -1) return dp[x][s];
  dp[x][s] = 0;
  for (int i = (0); i < (MAXN); i++) dp2[x][i] = 0;
  for (int j = (x + 1); j < (n); j++) {
    dp2[x][j + 1] = max(dp2[x][j + 1], dp2[x][j]);
    if (arr[x].in <= arr[j].in && arr[j].out <= arr[x].out) {
      dp2[x][ne[j]] =
          max(dp2[x][ne[j]],
              dp2[x][j] + arr[j].val + rek(j, min(arr[j].str, s - arr[j].we)));
    }
  }
  dp[x][s] = dp2[x][n];
  return dp[x][s];
}
int main() {
  ios_base::sync_with_stdio(false);
  memset(dp, -1, sizeof dp);
  int S;
  cin >> n >> S;
  arr[0] = {0, MAXN, MAXN, 0, 0};
  for (int i = (0); i < (n); i++) {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    arr[i + 1] = {a, b, c, d, e};
  }
  n++;
  sort(arr, arr + n, cmp);
  for (int i = (0); i < (n); i++) {
    ne[i] = n;
    for (int j = (i + 1); j < (n); j++) {
      if (arr[j].in >= arr[i].out) {
        ne[i] = j;
        break;
      }
    }
  }
  cout << rek(0, S) << endl;
  return 0;
}
