#include <bits/stdc++.h>
using namespace std;
const int N = 101000;
const int INF = 2147483647;
const int MAXNODE = N * 2, MAXEDGE = N * 5;
struct Edge;
struct Node {
  int id;
  Edge* head;
  Node* boss;
  Edge* path;
  bool reached;
  int dis;
};
struct Edge {
  int id;
  Node* dest;
  Edge* next;
  int len;
};
Node node[MAXNODE];
Edge edge[MAXEDGE];
int nEdge;
void clearEdge() { nEdge = 0; }
void addEdge(int u, int v, int w, int id) {
  edge[nEdge].id = id;
  edge[nEdge].len = w;
  edge[nEdge].dest = &node[v];
  edge[nEdge].next = node[u].head;
  node[u].head = &edge[nEdge];
  nEdge++;
}
struct Candidate {
  Node* node;
  int dis;
  bool operator<(const Candidate& c2) const { return dis > c2.dis; }
};
int minPath(int start, int finish) {
  priority_queue<Candidate> q;
  Candidate next;
  next.node = node + start;
  next.dis = 0;
  q.push(next);
  while (!q.empty() && !node[finish].reached) {
    Candidate top = q.top();
    q.pop();
    Node* boss = top.node;
    if (boss->reached) continue;
    boss->reached = true;
    boss->dis = top.dis;
    Edge* i;
    for (i = boss->head; i; i = i->next) {
      Node* dest = i->dest;
      if (dest->reached) continue;
      if (dest->dis <= boss->dis + i->len) continue;
      dest->boss = boss;
      dest->path = i;
      dest->dis = boss->dis + i->len;
      next.node = dest;
      next.dis = dest->dis;
      q.push(next);
    }
  }
  return node[finish].dis;
}
struct Ramp {
  int id;
  int begin, end, time;
};
vector<Ramp> ramp;
vector<int> v;
int nv;
int getIndex(int x) {
  int l = 0, r = nv, m;
  while (l + 1 < r) {
    m = (l + r) / 2;
    if (v[m] <= x)
      l = m;
    else
      r = m;
  }
  return l;
}
int main() {
  ios::sync_with_stdio(false);
  int n, l;
  cin >> n >> l;
  v.push_back(0);
  v.push_back(l);
  int i;
  for (i = 0; i < n; i++) {
    int x, d, t, p;
    cin >> x >> d >> t >> p;
    Ramp r;
    r.id = i + 1;
    r.begin = x - p;
    r.end = x + d;
    r.time = t + p;
    if (r.begin < 0 || r.end > l) continue;
    if (r.time >= r.end - r.begin) continue;
    ramp.push_back(r);
    v.push_back(r.begin);
    v.push_back(r.end);
  }
  int nr = ramp.size();
  sort(v.begin(), v.end());
  nv = unique(v.begin(), v.end()) - v.begin();
  for (i = 0; i < nv; i++) {
    node[i].id = i;
    node[i].head = 0;
    node[i].dis = INF;
    node[i].reached = false;
  }
  for (i = 0; i + 1 < nv; i++) {
    addEdge(i, i + 1, v[i + 1] - v[i], -1);
    addEdge(i + 1, i, v[i + 1] - v[i], -1);
  }
  for (i = 0; i < nr; i++) {
    addEdge(getIndex(ramp[i].begin), getIndex(ramp[i].end), ramp[i].time,
            ramp[i].id);
  }
  cout << minPath(0, getIndex(l)) << endl;
  vector<int> solution;
  for (i = getIndex(l); i != 0; i = node[i].boss - node) {
    if (node[i].path->id != -1) {
      solution.push_back(node[i].path->id);
    }
  }
  cout << solution.size() << endl;
  for (i = (int)solution.size() - 1; i >= 0; i--) {
    cout << solution[i] << endl;
  }
  return 0;
}
