#include <bits/stdc++.h>
using namespace std;
const int N = 250000;
int n, L;
int x[N], d[N], t[N], p[N];
vector<int> X;
vector<pair<int, pair<int, int> > > g[N];
map<int, int> mapp, rmap;
int dist[N];
set<pair<int, int> > S;
set<pair<int, int> >::iterator it;
pair<int, int> par[N];
void add_point(int x) { X.push_back(x); }
int get_id(int x) { return mapp[x]; }
void add_edge(int a, int b, int c, int tp) {
  g[a].push_back(make_pair(b, make_pair(c, tp)));
}
void mapp_points() {
  sort(X.begin(), X.end());
  int cnt = 0;
  for (int i = 0; i < X.size(); i++) {
    if (i == 0 || X[i] != X[i - 1]) {
      mapp[X[i]] = cnt;
      rmap[cnt] = X[i];
      ++cnt;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> L;
  add_point(0);
  add_point(L);
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> d[i] >> t[i] >> p[i];
    if (x[i] - p[i] >= 0) add_point(x[i] - p[i]);
    add_point(x[i] + d[i]);
  }
  mapp_points();
  for (int i = 1; i <= n; i++) {
    if (x[i] - p[i] < 0) continue;
    int id1 = get_id(x[i] - p[i]);
    int id2 = get_id(x[i] + d[i]);
    add_edge(id1, id2, p[i] + t[i], i);
  }
  int N = mapp.size();
  for (int i = 0; i + 1 < N; i++) {
    int x1 = rmap[i];
    int x2 = rmap[i + 1];
    add_edge(i, i + 1, x2 - x1, 0);
    add_edge(i + 1, i, x2 - x1, 0);
  }
  for (int i = 0; i < N; i++) dist[i] = 1e9 + 1e6;
  dist[0] = 0;
  for (int i = 0; i < N; i++) S.insert(make_pair(dist[i], i));
  while (S.size()) {
    it = S.begin();
    pair<int, int> tp = (*it);
    S.erase(it);
    int qv = tp.second;
    for (int i = 0; i < g[qv].size(); i++) {
      int to = g[qv][i].first;
      int tcost = g[qv][i].second.first + dist[qv];
      if (tcost < dist[to]) {
        S.erase(make_pair(dist[to], to));
        par[to] = make_pair(qv, g[qv][i].second.second);
        dist[to] = tcost;
        S.insert(make_pair(dist[to], to));
      }
    }
  }
  cout << dist[N - 1] << endl;
  vector<int> ans;
  int cur = N - 1;
  while (cur != 0) {
    pair<int, int> P = par[cur];
    if (P.second > 0) ans.push_back(P.second);
    cur = P.first;
  }
  reverse(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  return 0;
}
