#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3 * 100 * 1000 + 17, inf = 2e9 + 17;
int n, l, d[MAXN];
pair<int, int> par[MAXN];
map<int, int> mp;
vector<pair<int, pair<int, int>>> adj[MAXN];
vector<int> ans;
set<pair<pair<int, int>, pair<int, int>>> edge;
set<int> node;
void dij() {
  fill(d, d + MAXN, inf);
  set<pair<int, int>> s;
  s.insert({0, 1});
  d[1] = 0;
  while (!s.empty()) {
    int u = s.begin()->second;
    s.erase(s.begin());
    for (auto v : adj[u])
      if (d[v.first] > d[u] + v.second.first) {
        s.erase({d[v.first], v.first});
        d[v.first] = d[u] + v.second.first;
        s.insert({d[v.first], v.first});
        par[v.first] = {u, v.second.second};
      }
  }
}
void find_path(int v = mp[l]) {
  if (v == 1) return;
  if (par[v].second) ans.push_back(par[v].second);
  find_path(par[v].first);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> l;
  node.insert(0);
  node.insert(l);
  for (int i = 0; i < n; i++) {
    int x, d, t, p;
    cin >> x >> d >> t >> p;
    if (x - p >= 0) {
      node.insert(x - p);
      node.insert(x + d);
      node.insert(x);
      edge.insert({{x - p, x + d}, {t + p, i + 1}});
    }
  }
  int cnt = 0;
  auto itr = node.begin();
  while (itr != node.end()) {
    cnt++;
    mp[*itr] = cnt;
    if (cnt > 1) {
      auto it = itr;
      --it;
      int t = (*itr) - (*it);
      adj[cnt].push_back({cnt - 1, {t, 0}});
      adj[cnt - 1].push_back({cnt, {t, 0}});
    }
    itr++;
  }
  for (auto e : edge)
    adj[mp[e.first.first]].push_back({mp[e.first.second], e.second});
  dij();
  find_path();
  cout << d[mp[l]] << endl;
  cout << ans.size() << endl;
  reverse(ans.begin(), ans.end());
  for (auto i : ans) cout << i << " ";
  return 0;
}
