#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>, int>> e[300005];
int at[100000], fr[100000], to[100000], cs[100000];
int dp[300005], pt[300005], rm[300005], in[300005];
int main() {
  int n, l;
  scanf("%d%d", &n, &l);
  vector<int> u;
  u.push_back(0);
  u.push_back(l);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d%d", at + i, to + i, cs + i, fr + i);
    if (at[i] - fr[i] < 0) continue;
    u.push_back(at[i]);
    u.push_back(at[i] - fr[i]);
    u.push_back(at[i] + to[i]);
  }
  sort(u.begin(), u.end());
  u.erase(unique(u.begin(), u.end()), u.end());
  for (size_t i = 0; i + 1 < u.size(); i++) {
    e[i].push_back({{i + 1, 0}, u[i + 1] - u[i]});
    e[i + 1].push_back({{i, 0}, u[i + 1] - u[i]});
  }
  for (int i = 0; i < n; i++) {
    if (at[i] - fr[i] < 0) continue;
    int x = lower_bound(u.begin(), u.end(), at[i] - fr[i]) - u.begin();
    int y = lower_bound(u.begin(), u.end(), at[i] + to[i]) - u.begin();
    e[x].push_back({{y, i + 1}, cs[i] + fr[i]});
  }
  priority_queue<pair<int, int>> q;
  memset(dp, 63, sizeof(dp));
  for (q.push({dp[0] = 0, 0}); q.size(); q.pop()) {
    int x = q.top().second;
    if (in[x]++) continue;
    for (auto r : e[x]) {
      int y = r.first.first;
      if (dp[x] + r.second < dp[y]) {
        dp[y] = dp[x] + r.second;
        rm[y] = r.first.second;
        pt[y] = x;
        q.push({-dp[y], y});
      }
    }
  }
  deque<int> ans;
  printf("%d\n", dp[u.size() - 1]);
  for (int i = u.size() - 1; i; i = pt[i])
    if (rm[i]) ans.push_front(rm[i]);
  printf("%d\n", ans.size());
  for (auto r : ans) printf("%d ", r);
}
