#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 9;
int l[N], r[N], w[N], s[N], v[N];
vector<int> adr[N];
int dp[N][N];
int best[N];
pair<int, int> sr[N];
int main() {
  ios_base::sync_with_stdio(0);
  int n, sw;
  cin >> n >> sw;
  for (int i = 0; i < n; ++i) {
    cin >> l[i] >> r[i] >> w[i] >> s[i] >> v[i], l[i]++, r[i]++,
        adr[l[i]].push_back(i), adr[r[i]].push_back(i);
    sr[i] = {r[i] - l[i], i};
  }
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j) dp[i][j] = -1e9;
  sr[n] = {2 * n + 1, n};
  l[n] = 0, r[n] = 2 * n + 1, s[n] = sw, adr[l[n]].push_back(n),
  adr[r[n]].push_back(n);
  n++;
  sort(sr, sr + n);
  for (int p = 0; p < n; ++p) {
    int i = sr[p].second;
    for (int k = 0; k <= s[i]; ++k) {
      memset(best, 0, sizeof best);
      dp[i][k] =
          ((dp[i][k]) < (dp[i][k - (k ? 1 : 0)]) ? (dp[i][k - (k ? 1 : 0)])
                                                 : (dp[i][k]));
      best[l[i]] = 0;
      for (int j = l[i]; j <= r[i]; ++j) {
        best[j] = ((best[j]) < (best[j - (j ? 1 : 0)]) ? (best[j - (j ? 1 : 0)])
                                                       : (best[j]));
        for (int m = 0; m < (int)adr[j].size(); ++m) {
          int id = adr[j][m];
          if (id == i) continue;
          if (j == l[id] && -1 < k - w[id]) {
            best[r[id]] =
                ((best[r[id]]) < (best[j] +
                                  dp[id][((s[id]) < (k - w[id]) ? (s[id])
                                                                : (k - w[id]))])
                     ? (best[j] +
                        dp[id][((s[id]) < (k - w[id]) ? (s[id]) : (k - w[id]))])
                     : (best[r[id]]));
          }
        }
      }
      dp[i][k] =
          ((dp[i][k]) < (best[r[i]] + v[i]) ? (best[r[i]] + v[i]) : (dp[i][k]));
    }
  }
  cout << dp[n - 1][sw] << '\n';
  return 0;
}
