#include <bits/stdc++.h>
using namespace std;
const int inf = 1000111000;
struct Point {
  int id;
  int x;
  int v[3];
  int t[3];
  int p;
};
struct Info {
  int len;
  int num;
  int p;
  Info() {}
  Info(int tlen, int tnum, int tp) {
    len = tlen;
    num = tnum;
    p = tp;
  }
};
struct InfoLess {
  bool operator()(const Info i1, const Info &i2) {
    if (i1.len == i2.len) return i1.num < i2.num;
    return i1.len < i2.len;
  }
};
int n, l;
int pn;
Point pt[200111];
pair<int, int> pr[200111];
bool used[200111];
int best[200111];
void read() {
  int x, d, t, p;
  Point temp;
  cin >> n >> l;
  pt[0].x = 0;
  pt[0].t[0] = l;
  pt[0].t[1] = inf;
  pt[0].t[2] = inf;
  pt[1].x = l;
  pt[1].t[0] = inf;
  pt[1].t[1] = inf;
  pt[1].t[2] = inf;
  pt[0].v[0] = 1;
  pn = 2;
  temp.v[0] = 0;
  temp.v[1] = 0;
  temp.v[2] = 0;
  temp.t[1] = inf;
  temp.t[2] = inf;
  for (int i = 0; i < n; i++) {
    cin >> x >> d >> t >> p;
    if (t >= d) continue;
    temp.id = i + 1;
    temp.x = x - p;
    temp.t[0] = t + p;
    if (temp.x < 0) continue;
    pt[pn++] = temp;
    temp.id = 0;
    temp.x = x + d;
    temp.t[0] = inf;
    pt[pn++] = temp;
    pt[pn - 2].v[0] = pn - 1;
  }
  for (int i = 0; i < pn; i++) {
    pr[i].first = pt[i].x;
    pr[i].second = i;
  }
  sort(pr, pr + pn);
  for (int i = 0; i < pn - 1; i++) {
    pt[pr[i].second].v[1] = pr[i + 1].second;
    pt[pr[i + 1].second].v[2] = pr[i].second;
    ;
    pt[pr[i].second].t[1] = pr[i + 1].first - pr[i].first;
    pt[pr[i + 1].second].t[2] = pr[i + 1].first - pr[i].first;
  }
}
void solve() {
  set<Info, InfoLess> rib;
  Info temp;
  for (int i = 0; i < pn; i++) best[i] = inf;
  rib.insert(Info(0, 0, 0));
  while (!rib.empty()) {
    temp = *rib.begin();
    rib.erase(rib.begin());
    if (used[temp.num]) continue;
    used[temp.num] = true;
    best[temp.num] = temp.len;
    pt[temp.num].p = temp.p;
    for (int i = 0; i < 3; i++) {
      rib.insert(
          Info(temp.len + pt[temp.num].t[i], pt[temp.num].v[i], temp.num));
    }
  }
}
void write() {
  vector<int> ans;
  int td = 1;
  while (td != 0) {
    if ((pt[pt[td].p].v[0] == td) && (pt[pt[td].p].id != 0))
      ans.push_back(pt[pt[td].p].id);
    td = pt[td].p;
  }
  reverse(ans.begin(), ans.end());
  cout << best[1] << endl;
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
}
int main() {
  read();
  solve();
  write();
  return 0;
}
