#include <bits/stdc++.h>
using namespace std;
const int MN = 200111;
int n, L;
struct Ramp {
  int x, d, t, p;
} a[MN];
int c[MN], nc;
vector<pair<pair<int, int>, int> > ke[MN];
void addEdge(int u, int v, int c, int typ) {
  ke[u].push_back(make_pair(make_pair(v, c), typ));
}
void RR() {
  c[++nc] = 0;
  c[++nc] = L;
  for (int i = (1), _b = (n); i <= _b; i++)
    if (a[i].x >= a[i].p) {
      c[++nc] = a[i].x - a[i].p;
      c[++nc] = a[i].x + a[i].d;
    }
  sort(c + 1, c + nc + 1);
  nc = unique(c + 1, c + nc + 1) - c - 1;
  for (int i = (1), _b = (nc); i <= _b; i++) ke[i].clear();
  for (int i = (1), _b = (nc - 1); i <= _b; i++) {
    addEdge(i, i + 1, c[i + 1] - c[i], 0);
    addEdge(i + 1, i, c[i + 1] - c[i], 0);
  }
  for (int i = (1), _b = (n); i <= _b; i++)
    if (a[i].x >= a[i].p) {
      int u = lower_bound(c + 1, c + nc + 1, a[i].x - a[i].p) - c;
      int v = lower_bound(c + 1, c + nc + 1, a[i].x + a[i].d) - c;
      addEdge(u, v, a[i].p + a[i].t, i);
    }
}
int f[MN], tru[MN], trt[MN];
vector<int> res;
void trace(int v) {
  if (v == 1) return;
  int u = tru[v];
  trace(u);
  if (trt[v]) res.push_back(trt[v]);
}
int main() {
  ios ::sync_with_stdio(false);
  while (cin >> n >> L) {
    for (int i = (1), _b = (n); i <= _b; i++)
      cin >> a[i].x >> a[i].d >> a[i].t >> a[i].p;
    RR();
    for (int i = (1), _b = (nc); i <= _b; i++) f[i] = 1000111000;
    f[1] = 0;
    set<pair<int, int> > s;
    s.insert(make_pair(0, 1));
    while (!s.empty()) {
      int l = s.begin()->first, u = s.begin()->second;
      s.erase(s.begin());
      if (l != f[u]) continue;
      for (auto e : ke[u]) {
        int v = e.first.first, c = e.first.second;
        if (f[v] > f[u] + c) {
          f[v] = f[u] + c;
          s.insert(make_pair(f[v], v));
          tru[v] = u;
          trt[v] = e.second;
        }
      }
    }
    cout << f[nc] << endl;
    res.clear();
    trace(nc);
    cout << res.size() << endl;
    for (auto x : res) cout << x << ' ';
    cout << endl;
  }
}
