#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long dx[4] = {-1, 1, 0, 0};
const long long dy[4] = {0, 0, -1, 1};
const long long MAX = 1e6 + 5;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long n, m, k, Q, l, x, y, ans, cap;
long long dist[MAX], par[MAX], ramp[MAX], spec[MAX];
bool done[MAX], vis[MAX];
vector<vector<pair<int, pair<long long, long long> > > > g;
void dij(int src) {
  priority_queue<pair<long long, int> > pq;
  for (int i = 0; i < MAX; ++i) dist[i] = 1e18;
  dist[src] = 0;
  pq.push({0, src});
  while (!pq.empty()) {
    int u = pq.top().second;
    long long d = -1ll * pq.top().first;
    pq.pop();
    if (dist[u] < d) continue;
    for (auto v : g[u]) {
      if (dist[u] + v.second.first < dist[v.first]) {
        spec[v.first] = v.second.second;
        par[v.first] = u;
        dist[v.first] = dist[u] + v.second.first;
        pq.push({-dist[v.first], v.first});
      }
    }
  }
}
map<long long, int> id;
map<int, long long> rev;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  g.clear();
  g.resize(MAX);
  long long L;
  cin >> n >> L;
  id[0] = 0;
  set<long long> S;
  S.insert(0);
  int ind = 1;
  for (int i = 0; i < n; ++i) {
    long long x, d, t, p;
    cin >> x >> d >> t >> p;
    if (x - p < 0) continue;
    if (id.find(x - p) == id.end()) id[x - p] = ind++;
    if (id.find(x + d) == id.end()) id[x + d] = ind++;
    g[id[x - p]].push_back({id[x + d], {p + t, i + 1}});
    S.insert(x - p);
    S.insert(x + d);
  }
  if (id.find(L) == id.end()) id[L] = ind;
  S.insert(L);
  int prev = -1;
  for (auto it : S) {
    if (prev != -1) {
      g[id[prev]].push_back({id[it], {it - prev, 0}});
      g[id[it]].push_back({id[prev], {it - prev, 0}});
    }
    prev = it;
  }
  dij(0);
  cout << dist[id[L]] << '\n';
  int u = id[L];
  vector<int> res;
  while (1) {
    if (spec[u]) res.push_back(spec[u]);
    if (u == 0) break;
    u = par[u];
  }
  cout << (int)res.size() << '\n';
  reverse(res.begin(), res.end());
  for (int i = 0; i < (int)res.size(); ++i) cout << res[i] << ' ';
  return 0;
}
