#include <bits/stdc++.h>
using namespace std;
const int sz = 1 << 19;
struct edge {
  int t, w, i;
  edge(int t, int w, int i) : t(t), w(w), i(i) {}
};
vector<edge> g[200005];
vector<tuple<int, int, int, int>> ramp;
int pn[200005], pi[200005], dist[200005];
vector<int> itp;
map<int, int> pti;
int main() {
  int n, m, L;
  scanf("%d%d", &n, &L);
  itp.push_back(0);
  itp.push_back(L);
  for (int i = 1; i <= n; i++) {
    int x, d, t, p;
    scanf("%d%d%d%d", &x, &d, &t, &p);
    if (x - p < 0) continue;
    ramp.emplace_back(x - p, x + d, t + p, i);
    itp.push_back(x - p);
    itp.push_back(x + d);
  }
  sort(itp.begin(), itp.end());
  itp.erase(unique(itp.begin(), itp.end()), itp.end());
  m = itp.size() - 1;
  for (int i = 1; i <= m; i++) {
    pti[itp[i]] = i;
    int w = itp[i] - itp[i - 1];
    g[i - 1].push_back(edge(i, w, 0));
    g[i].push_back(edge(i - 1, w, 0));
  }
  for (int i = 1; i <= m; i++) dist[i] = 1e9;
  n = ramp.size();
  sort(ramp.begin(), ramp.end());
  for (int i = 0; i < n; i++) {
    int fr, to, tt, idx;
    tie(fr, to, tt, idx) = ramp[i];
    fr = pti[fr];
    to = pti[to];
    g[fr].push_back(edge(to, tt, idx));
  }
  priority_queue<pair<int, int>> pq;
  pq.emplace(0, 0);
  pn[0] = -1;
  while (!pq.empty()) {
    int w = -pq.top().first;
    int c = pq.top().second;
    pq.pop();
    if (c == m) break;
    if (w > dist[c]) continue;
    for (auto e : g[c]) {
      int w2 = w + e.w;
      if (w2 >= dist[e.t]) continue;
      pn[e.t] = c;
      pi[e.t] = e.i;
      dist[e.t] = w2;
      pq.emplace(-w2, e.t);
    }
  }
  int ans1 = dist[m], ans2 = m;
  vector<int> lst;
  while (ans2 > -1) {
    if (pi[ans2]) lst.push_back(pi[ans2]);
    ans2 = pn[ans2];
  }
  printf("%d\n%d\n", ans1, lst.size());
  for (int i = lst.size() - 1; i >= 0; i--) printf("%d\n", lst[i]);
}
