#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5, MAX_L = 1e9;
struct edge {
  int from, to, cost, id;
} sG[MAX_N + 5];
vector<edge> G[2 * MAX_N + 5];
int d[2 * MAX_N + 5], local[2 * MAX_N + 5], perv[2 * MAX_N + 5],
    id[2 * MAX_N + 5];
int n, L, a = 0, b = 0;
bool cmp_G(const edge& a, const edge& b) { return a.from < b.from; }
void solve() {
  sort(sG, sG + n, cmp_G);
  sort(local, local + a);
  for (int i = 0; i < a - 1; i++) {
    if (local[i] != local[i + 1]) local[b++] = local[i];
  }
  local[b++] = local[a - 1];
  local[b++] = L;
  edge e1, e2;
  e1.id = e2.id = 0;
  e1.to = 1;
  e1.cost = local[1] - local[0];
  e2.to = b - 1;
  e2.cost = local[b - 1] - local[b - 2];
  G[0].push_back(e1);
  G[b - 2].push_back(e2);
  for (int i = 1; i < b - 1; i++) {
    e1.to = i - 1;
    e1.cost = local[i] - local[i - 1];
    e2.to = i + 1;
    e2.cost = local[i + 1] - local[i];
    G[i].push_back(e1);
    G[i].push_back(e2);
  }
  for (int i = 0; i < n; i++) {
    int start = lower_bound(local, local + b, sG[i].from) - local;
    int end = lower_bound(local, local + b, sG[i].to) - local;
    e1.to = end;
    e1.cost = sG[i].cost;
    e1.id = sG[i].id;
    G[start].push_back(e1);
  }
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      que;
  memset(d, 0x3f, sizeof(d));
  d[0] = 0;
  que.push(pair<int, int>(0, 0));
  int to, cost;
  perv[0] = -1;
  while (!que.empty()) {
    pair<int, int> p = que.top();
    que.pop();
    int v = p.second;
    if (d[v] < p.first) continue;
    for (int i = 0; i < G[v].size(); i++) {
      edge e = G[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        perv[e.to] = v;
        id[e.to] = e.id;
        que.push(pair<int, int>(d[e.to], e.to));
      }
    }
  }
  printf("%d\n", d[b - 1]);
  vector<int> path;
  for (int t = b - 1; t != -1; t = perv[t]) {
    if (id[t] != 0) path.push_back(id[t]);
  }
  reverse(path.begin(), path.end());
  printf("%d\n", path.size());
  for (int i = 0; i < path.size(); i++) printf("%d\n", path[i]);
}
int main() {
  int x, d, t, p, cnt = 0;
  edge e1;
  local[a++] = 0;
  scanf("%d%d", &n, &L);
  for (int i = 0; i < n; i++) {
    cnt++;
    scanf("%d%d%d%d", &x, &d, &t, &p);
    if (x - p < 0 || x + d > L || d <= t) {
      i--;
      n--;
      continue;
    }
    sG[i].from = x - p;
    sG[i].to = x + d;
    sG[i].cost = p + t;
    sG[i].id = cnt;
    local[a++] = sG[i].from;
    local[a++] = sG[i].to;
  }
  solve();
  return 0;
}
