#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 1;
const int INF = 2e9;
map<int, int> m;
map<int, int>::iterator it;
int n, l, x, d, t, p, cnt, tt[MAXN], dis[MAXN], dist[MAXN], par[MAXN],
    num[MAXN];
vector<pair<pair<int, int>, int> > adj[MAXN];
vector<int> ans;
set<pair<int, int> > st;
pair<int, int> po[MAXN];
void dijkstra(int v) {
  for (int i = 0; i <= cnt; i++) dist[i] = INF;
  dist[v] = 0;
  st.insert(make_pair(dist[v], v));
  while (!st.empty()) {
    int t = st.begin()->second;
    st.erase(st.begin());
    for (int i = 0; i < adj[t].size(); i++)
      if (dist[adj[t][i].first.first] > dist[t] + adj[t][i].first.second) {
        par[adj[t][i].first.first] = t;
        num[adj[t][i].first.first] = adj[t][i].second;
        st.erase(make_pair(dist[adj[t][i].first.first], adj[t][i].first.first));
        dist[adj[t][i].first.first] = dist[t] + adj[t][i].first.second;
        st.insert(
            make_pair(dist[adj[t][i].first.first], adj[t][i].first.first));
      }
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> l;
  m[0] = 0, m[l] = 0;
  memset(po, -1, sizeof po);
  for (int i = 0; i < n; i++) {
    cin >> x >> d >> t >> p;
    if (x >= p)
      tt[i] = t + p, m[x - p] = 0, m[x + d] = 0, po[i].first = x - p,
      po[i].second = x + d;
  }
  for (map<int, int>::iterator it = m.begin(); it != m.end(); it++)
    cnt++, it->second = cnt, dis[cnt] = it->first;
  for (int i = 1; i < cnt; i++)
    adj[m[dis[i + 1]]].push_back(
        make_pair(make_pair(m[dis[i]], dis[i + 1] - dis[i]), -1)),
        adj[m[dis[i]]].push_back(
            make_pair(make_pair(m[dis[i + 1]], dis[i + 1] - dis[i]), -1));
  for (int i = 0; i < n; i++)
    if (po[i].first != -1)
      adj[m[po[i].first]].push_back(
          make_pair(make_pair(m[po[i].second], tt[i]), i + 1));
  dijkstra(1);
  cout << dist[cnt] << endl;
  int x = cnt;
  while (x != 1) {
    if (num[x] != -1) ans.push_back(num[x]);
    x = par[x];
  }
  cout << ans.size() << endl;
  for (int i = ans.size() - 1; i >= 0; i--) cout << ans[i] << " ";
  return 0;
}
