#include <bits/stdc++.h>
using namespace std;
const int oo = 1 << 30;
const double PI = 3.1415926535897932384626433832795;
const double EPS = 1e-15;
const int MaxN = 100001, MaxM = 3 * MaxN;
struct ramp {
  long long x, d, t, p;
  ramp() {}
  ramp(long long x, long long d, long long t, long long p)
      : x(x), d(d), t(t), p(p) {}
};
struct edge {
  long long dest;
  long long time;
  int ramp;
  edge() {}
  edge(long long dest, long long time, int ramp)
      : dest(dest), time(time), ramp(ramp) {}
};
int n;
long long L;
ramp ramps[MaxN];
long long coo[MaxM];
int size;
vector<edge> g[MaxM];
priority_queue<pair<long long, int> > Q;
pair<int, int> last[MaxM];
long long best[MaxM];
vector<int> rampsInSolution;
void add_edge(int u, int w, int time, int ramp_id) {
  u = lower_bound(coo, coo + size, u) - coo;
  w = lower_bound(coo, coo + size, w) - coo;
  g[u].push_back(edge(w, time, ramp_id));
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> L;
  for (int i = 0; i < n; i++) {
    cin >> ramps[i].x >> ramps[i].d >> ramps[i].t >> ramps[i].p;
    if (ramps[i].x - ramps[i].p >= 0) {
      coo[size++] = ramps[i].x - ramps[i].p;
      coo[size++] = ramps[i].x + ramps[i].d;
    }
  }
  coo[size++] = 0;
  coo[size++] = L;
  sort(coo, coo + size);
  size = unique(coo, coo + size) - coo;
  for (int i = 1; i < size; i++) {
    add_edge(coo[i - 1], coo[i], coo[i] - coo[i - 1], -1);
    add_edge(coo[i], coo[i - 1], coo[i] - coo[i - 1], -1);
  }
  for (int i = 0; i < n; i++)
    if (ramps[i].x - ramps[i].p >= 0) {
      add_edge(ramps[i].x - ramps[i].p, ramps[i].x + ramps[i].d,
               ramps[i].p + ramps[i].t, i);
    }
  best[0] = 0;
  for (int i = 1; i < size; i++) best[i] = oo;
  Q.push({0, 0});
  while (!Q.empty()) {
    int node = Q.top().second;
    int time = -Q.top().first;
    Q.pop();
    if (time > best[node]) continue;
    for (int i = 0; i < g[node].size(); i++) {
      int dest = g[node][i].dest;
      long long edge_time = g[node][i].time;
      if (best[dest] > time + edge_time) {
        best[dest] = time + edge_time;
        last[dest] = {node, g[node][i].ramp};
        Q.push({-best[dest], dest});
      }
    }
  }
  cout << best[size - 1] << endl;
  int node = size - 1;
  while (node != 0) {
    if (last[node].second != -1) {
      rampsInSolution.push_back(last[node].second);
    }
    node = last[node].first;
  }
  cout << rampsInSolution.size() << endl;
  for (int i = rampsInSolution.size() - 1; i >= 0; i--) {
    cout << rampsInSolution[i] + 1 << endl;
  }
  return 0;
}
