#include <bits/stdc++.h>
const int maxn = 100005;
using namespace std;
struct edge {
  int u, w, id;
  edge(int u, int w, int id) : u(u), w(w), id(id) {}
};
int dis[2 * maxn], x[maxn], p[maxn], d[maxn], t[maxn];
bool mark[2 * maxn];
pair<int, int> par[2 * maxn];
vector<edge> v[2 * maxn];
vector<int> X;
void dijkstra(int n, int src, int des) {
  fill(dis, dis + n, 2e9);
  dis[src] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  pq.push({0, src});
  par[src] = {-1, 0};
  while (!pq.empty()) {
    int cur = pq.top().second;
    pq.pop();
    if (mark[cur]) continue;
    mark[cur] = true;
    for (edge e : v[cur]) {
      int u = e.u, w = e.w;
      if (dis[u] > dis[cur] + w) {
        dis[u] = dis[cur] + w;
        pq.push({dis[u], u});
        par[u] = {cur, e.id};
      }
    }
  }
  cout << dis[des] << endl;
  vector<int> rmp;
  for (int it = des; it != -1; it = par[it].first)
    if (par[it].second) rmp.push_back(par[it].second);
  cout << rmp.size() << endl;
  for (int i = int(rmp.size()) - 1; i >= 0; i--) cout << rmp[i] << ' ';
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, L;
  cin >> n >> L;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> d[i] >> t[i] >> p[i];
    if (x[i] - p[i] >= 0) X.push_back(x[i] - p[i]);
    X.push_back(x[i] + d[i]);
  }
  X.push_back(0);
  X.push_back(L);
  sort(X.begin(), X.end());
  int N = X.size();
  for (int i = 0; i < N; i++) {
    if (i + 1 < N) v[i].push_back(edge(i + 1, X[i + 1] - X[i], 0));
    if (i - 1 >= 0) v[i].push_back(edge(i - 1, X[i] - X[i - 1], 0));
  }
  for (int i = 0; i < n; i++) {
    if (x[i] - p[i] < 0) continue;
    int src = lower_bound(X.begin(), X.end(), x[i] - p[i]) - X.begin();
    int des = lower_bound(X.begin(), X.end(), x[i] + d[i]) - X.begin();
    v[src].push_back(edge(des, p[i] + t[i], i + 1));
  }
  dijkstra(N, 0, N - 1);
  return 0;
}
