#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4 * 1000 * 100 + 10, INF = 10000 * 10000 * 20;
vector<int> node;
vector<pair<int, pair<int, int> > > vec[MAXN];
int dist[MAXN];
pair<int, int> par[MAXN];
map<int, int> mp;
int n, L;
void djk(int v) {
  par[v] = {-1, -1};
  for (int i = 0; i < (int)node.size(); i++) dist[mp[node[i]]] = INF;
  dist[v] = 0;
  set<pair<int, int> > st;
  st.insert({0, v});
  while (!st.empty()) {
    v = st.begin()->second;
    st.erase(st.begin());
    for (auto u : vec[v])
      if (dist[u.first] > dist[v] + u.second.first) {
        st.erase({dist[u.first], u.first});
        dist[u.first] = dist[v] + u.second.first;
        par[u.first] = {v, u.second.second};
        st.insert({dist[u.first], u.first});
      }
  }
}
int main() {
  cin >> n >> L;
  int cnt = 1;
  node.push_back(0), node.push_back(L);
  mp[0] = cnt++, mp[L] = cnt++;
  for (int i = 0; i < n; i++) {
    int x, d, t, p;
    cin >> x >> d >> t >> p;
    if (x - p >= 0) {
      if (mp[x - p] == 0) mp[x - p] = cnt++;
      if (mp[x + d] == 0) mp[x + d] = cnt++;
      vec[mp[x - p]].push_back({mp[x + d], {p + t, i + 1}});
      node.push_back(x - p);
    }
    node.push_back(x);
    node.push_back(x + d);
  }
  sort(node.begin(), node.end());
  node.resize(unique(node.begin(), node.end()) - node.begin());
  for (int i = 0; i < (int)node.size(); i++)
    if (mp[node[i]] == 0) mp[node[i]] = cnt++;
  for (int i = 0; i < (int)node.size(); i++) {
    int a = mp[node[i]], b = (i - 1 >= 0) ? mp[node[i - 1]] : 0,
        c = (i + 1 < (int)node.size()) ? mp[node[i + 1]] : 0;
    if (i != 0) vec[a].push_back({b, {node[i] - node[i - 1], -1}});
    if (i != (int)node.size() - 1)
      vec[a].push_back({c, {node[i + 1] - node[i], -1}});
  }
  djk(mp[0]);
  pair<int, int> appa = {mp[L], -1};
  vector<int> ans;
  while (appa.first != -1) {
    if (appa.second != -1) ans.push_back(appa.second);
    appa = par[appa.first];
  }
  cout << dist[mp[L]] << endl << (int)ans.size() << endl;
  for (int i = (int)ans.size() - 1; i >= 0; i--)
    cout << ans[i] << " \n"[i == 0];
}
