#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, pair<int, int> > > > mp;
map<int, long long int> Dis;
map<int, pair<int, int> > pa;
set<pair<long long int, pair<int, pair<int, int> > > > Edg;
set<int> Ver;
int n, L, xi, di, pi, ti;
vector<int> Pat;
pair<long long int, pair<int, pair<int, int> > > mk(int tr, int p, int ra,
                                                    int w) {
  return make_pair(w, make_pair(tr, make_pair(p, ra)));
}
void AddV(int x) {
  set<int>::iterator it = Ver.find(x);
  if (it != Ver.begin()) {
    it--;
    Edg.insert(mk((*it), x, 0, Dis[x] + x - (*it)));
    it++;
  }
  it++;
  if (it != Ver.end()) Edg.insert(mk((*it), x, 0, Dis[x] + (*it) - x));
  it--;
  map<int, vector<pair<int, pair<int, int> > > >::iterator it1 = mp.find(x);
  if (it1 != mp.end())
    for (int i = 0; i < (*it1).second.size(); i++)
      Edg.insert(mk((*it1).second[i].second.first, x,
                    (*it1).second[i].second.second,
                    Dis[x] + (*it1).second[i].first));
}
void getmin() {
  if (Edg.empty()) return;
  set<pair<long long int, pair<int, pair<int, int> > > >::iterator it =
      Edg.begin();
  if (Dis[(*Edg.begin()).second.first] == 0 &&
      (*Edg.begin()).second.first != 0) {
    Dis[(*Edg.begin()).second.first] = (*Edg.begin()).first;
    pa[(*Edg.begin()).second.first].first = (*Edg.begin()).second.second.first;
    pa[(*Edg.begin()).second.first].second =
        (*Edg.begin()).second.second.second;
    AddV((*Edg.begin()).second.first);
  } else {
    Edg.erase(Edg.begin());
    getmin();
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> L;
  Ver.insert(0);
  Ver.insert(L);
  for (int i = 0; i < n; i++) {
    cin >> xi >> di >> ti >> pi;
    if (xi - pi < 0) continue;
    mp[xi - pi].push_back(make_pair(ti + pi, make_pair(xi + di, i + 1)));
    Ver.insert(xi - pi);
    Ver.insert(xi + di);
  }
  Dis[0] = 0;
  pa[0].first = -1;
  AddV(0);
  while (!Edg.empty()) getmin();
  cout << Dis[L];
  int c = L;
  while (true) {
    if (pa[c].second != 0) Pat.push_back(pa[c].second);
    c = pa[c].first;
    if (pa[c].first == -1) break;
  }
  cout << endl << Pat.size() << endl;
  for (int i = Pat.size() - 1; i >= 0; i--) {
    cout << Pat[i] << endl;
  }
}
