#include <bits/stdc++.h>
using namespace std;
const int inf(1010101010);
int n;
long long L;
struct brug {
  long long x, d, t, p;
};
vector<brug> objs;
struct edge {
  int y, lbl;
  long long wt;
};
edge ee[701005];
int ne(0);
vector<vector<int> > adj(701005);
long long d[701005];
int predv[701005], prede[701005];
void dijkstra(int s) {
  d[s] = 0, predv[s] = -1, prede[s] = -1;
  set<pair<int, int> > second;
  second.insert(make_pair(d[s], s));
  while (((int)(second).size())) {
    int x((*(second).begin()).second);
    second.erase((second).begin());
    for (__typeof((adj[x]).end()) it((adj[x]).begin()); it != (adj[x]).end();
         ++it) {
      edge& e(ee[*it]);
      int y(e.y), label(e.lbl);
      long long wt(e.wt);
      if (d[x] + wt < d[y]) {
        second.erase(make_pair(d[y], y));
        d[y] = d[x] + wt;
        predv[y] = x, prede[y] = label;
        second.insert(make_pair(d[y], y));
      }
    }
  }
}
vector<int> pts;
map<int, int> loc;
void ae(int x1, int x2, long long wt, int label) {
  int id1(loc[x1]), id2(loc[x2]);
  edge e = {id2, label, wt};
  ee[ne] = e;
  adj[id1].push_back(ne);
  ne++;
}
int main() {
  cin >> n >> L;
  pts.push_back(0), pts.push_back(L);
  for (int i(0); i < (n); i++) {
    int x, d, t, p;
    cin >> x >> d >> t >> p;
    brug br = {x, d, t, p};
    objs.push_back(br);
    pts.push_back(x - p), pts.push_back(x + p), pts.push_back(x + d);
  }
  sort((pts).begin(), (pts).end());
  pts.erase(unique((pts).begin(), (pts).end()), (pts).end());
  for (int i(0); i < (((int)(pts).size())); i++) loc[pts[i]] = i;
  for (int i(0); i < (n); i++) {
    brug& br(objs[i]);
    int x(br.x), d(br.d), t(br.t), p(br.p);
    ae(x - p, x + d, p + t, i);
  }
  for (int i(0); i < (((int)(pts).size()) - 1); i++) {
    ae(pts[i], pts[i + 1], pts[i + 1] - pts[i], -1);
    if (pts[i] >= 0) ae(pts[i + 1], pts[i], pts[i + 1] - pts[i], -1);
  }
  int s(loc[0]), t(loc[L]);
  for (int i(0); i < (((int)(pts).size())); i++) d[i] = 10101010101010LL;
  dijkstra(s);
  cout << d[t] << endl;
  vector<int> bridges;
  for (int x(t); x != (s); x = predv[x]) {
    if (prede[x] >= 0) bridges.push_back(prede[x]);
  }
  reverse((bridges).begin(), (bridges).end());
  cout << ((int)(bridges).size()) << endl;
  for (__typeof((bridges).end()) it((bridges).begin()); it != (bridges).end();
       ++it) {
    int br(*it);
    if (it != (bridges).begin()) cout << " ";
    cout << (1 + (*it));
  }
  cout << endl;
}
