#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>, int>> node[200011];
map<int, int> mymap;
long long dis[200011];
pair<int, int> parent[200011];
struct cmp {
  bool operator()(pair<int, int> a, pair<int, int> b) {
    return a.second > b.second;
  }
};
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, L;
  cin >> n >> L;
  int x, d, t, p;
  mymap[0] = 0;
  mymap[L] = 1;
  int index = 2;
  for (int i = 0; i < n; i++) {
    cin >> x >> d >> t >> p;
    if (p <= x) {
      if (mymap.find(x - p) == mymap.end()) {
        mymap[x - p] = index;
        index++;
      }
      if (mymap.find(x + d) == mymap.end()) {
        mymap[x + d] = index;
        index++;
      }
      node[mymap[x - p]].push_back(
          make_pair(make_pair(mymap[x + d], p + t), i + 1));
    }
  }
  for (map<int, int>::iterator it = mymap.begin(); it != mymap.end(); it++) {
    map<int, int>::iterator next = it;
    next++;
    if (next == mymap.end()) break;
    node[it->second].push_back(
        make_pair(make_pair(next->second, next->first - it->first), 0));
    node[next->second].push_back(
        make_pair(make_pair(it->second, next->first - it->first), 0));
  }
  for (int i = 0; i < index; i++) dis[i] = 1000000001;
  dis[mymap[0]] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int>>, cmp> dij;
  dij.push(make_pair(mymap[0], 0));
  while (!dij.empty()) {
    pair<int, int> p = dij.top();
    int u = p.first;
    dij.pop();
    for (int i = 0; i < node[u].size(); i++) {
      int v = node[u][i].first.first;
      if (dis[v] > dis[u] + node[u][i].first.second) {
        dis[v] = dis[u] + node[u][i].first.second;
        dij.push(make_pair(v, dis[v]));
        parent[v] = make_pair(u, i);
      }
    }
  }
  cout << dis[mymap[L]] << endl;
  vector<int> ans;
  p = mymap[L];
  while (p != 0) {
    int pre = parent[p].first;
    int ind = 0;
    if (node[pre][parent[p].second].second > 0)
      ans.push_back(node[pre][parent[p].second].second);
    p = pre;
  }
  cout << ans.size() << endl;
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ans[i] << endl;
  }
  return 0;
}
