#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T Abs(const T& value) {
  return value < 0 ? -value : value;
}
inline double sqr(const double& value) { return value * value; }
template <typename T>
inline T vm(const T& gjigu, const T& djigd, const T& x2, const T& y2) {
  return gjigu * y2 - x2 * djigd;
}
template <typename T>
inline T sm(const T& gjigu, const T& djigd, const T& x2, const T& y2) {
  return gjigu * x2 + y2 * djigd;
}
struct Edge {
  int To;
  int Cost;
  int Num;
  Edge(int to = 0, int cost = 0, int num = 0) : To(to), Cost(cost), Num(num) {}
};
const int inf = 1000 * 1000 * 1000 + 10;
map<int, vector<Edge> > edges;
vector<int> X;
map<int, int> dist;
map<int, int> previous;
map<int, int> prevX;
set<pair<int, int> > distances;
vector<int> answer;
int main() {
  int n, L;
  cin >> n >> L;
  edges[0];
  edges[L];
  X.push_back(0);
  X.push_back(L);
  for (int i = 0; i < n; ++i) {
    int xi, di, ti, pi;
    cin >> xi >> di >> ti >> pi;
    if (xi - pi >= 0) {
      edges[xi - pi].push_back(Edge(xi + di, ti + pi, i + 1));
      edges[xi + di];
      X.push_back(xi - pi);
      X.push_back(xi + di);
    }
  }
  sort(X.begin(), X.end());
  X.erase(unique(X.begin(), X.end()), X.end());
  for (map<int, vector<Edge> >::iterator it = edges.begin(); it != edges.end();
       ++it) {
    if (it->first != 0) {
      int toX = *(lower_bound(X.begin(), X.end(), it->first) - 1);
      it->second.push_back(Edge(toX, it->first - toX, -1));
    }
    if (it->first != L) {
      int toX = *upper_bound(X.begin(), X.end(), it->first);
      it->second.push_back(Edge(toX, toX - it->first, -1));
    }
  }
  for (int i = 0; i < X.size(); ++i) {
    dist[X[i]] = (X[i] == 0 ? 0 : X[i]);
    distances.insert(make_pair(dist[X[i]], X[i]));
    prevX[X[i]] = 0;
    previous[X[i]] = -1;
  }
  while (!distances.empty()) {
    int v = distances.begin()->second;
    distances.erase(distances.begin());
    vector<Edge>& e = edges[v];
    for (int i = 0; i < e.size(); ++i) {
      if (dist[e[i].To] > dist[v] + e[i].Cost) {
        pair<int, int> d(dist[e[i].To], e[i].To);
        distances.erase(distances.find(d));
        d.first = dist[v] + e[i].Cost;
        distances.insert(d);
        dist[e[i].To] = dist[v] + e[i].Cost;
        previous[e[i].To] = e[i].Num;
        prevX[e[i].To] = v;
      }
    }
  }
  cout << dist[L] << endl;
  int cur = L;
  while (cur != 0) {
    if (previous[cur] != -1) {
      answer.push_back(previous[cur]);
    }
    cur = prevX[cur];
  }
  cout << answer.size() << endl;
  for (int i = answer.size() - 1; i >= 0; --i) {
    cout << answer[i] << " ";
  }
  cout << endl;
  return 0;
}
