#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 5, INF = 1e9 + 1, SQ = 375, base = 100,
                    MOD = 610612741;
vector<pair<int, int>> v[N];
vector<pair<long long int, pair<int, int>>> e;
map<int, int> mp, dmp;
map<pair<int, int>, int> ep[N];
int dp[N], ch[N];
pair<int, int> back[N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long int u, w, c, sm = 0, n, m, l, x, d, t, p;
  cin >> n >> l;
  vector<int> tp;
  tp.push_back(l);
  tp.push_back(0);
  for (int i = 0; i < n; i++) {
    cin >> x >> d >> t >> p;
    if (x - p < 0) {
      e.push_back({-1, {-1, -1}});
      continue;
    }
    e.push_back({t + p, {x - p, x + d}});
    tp.push_back(x - p);
    tp.push_back(x + d);
  }
  sort(tp.begin(), tp.end());
  tp.resize(unique(tp.begin(), tp.end()) - tp.begin());
  for (int i = 0; i < tp.size(); i++) {
    mp[tp[i]] = i + 1;
    if (i) {
      c = tp[i] - tp[i - 1], v[i + 1].push_back({c, i}),
      v[i].push_back({c, i + 1});
    }
  }
  for (int i = 0; i < e.size(); i++) {
    auto x = e[i];
    if (x.first < 0) continue;
    u = mp[x.second.first];
    w = mp[x.second.second];
    v[u].push_back({x.first, w});
    ep[u][pair<int, int>{x.first, w}] = i + 1;
  }
  fill(dp, dp + N, INF);
  dp[1] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      pq;
  pq.push({dp[1], 1});
  while (pq.size()) {
    u = pq.top().second;
    pq.pop();
    ch[u] = 1;
    for (auto w : v[u]) {
      if (dp[u] + w.first < dp[w.second])
        dp[w.second] = dp[u] + w.first, pq.push({dp[w.second], w.second}),
        back[w.second] = {w.first, u};
    }
    while (pq.size() && ch[pq.top().second]) pq.pop();
  }
  u = mp[l];
  vector<int> mv;
  cout << dp[u] << '\n';
  while (u != 1) {
    c = ep[back[u].second][make_pair(back[u].first, u)];
    if (c) mv.push_back(c);
    u = back[u].second;
  }
  reverse(mv.begin(), mv.end());
  cout << mv.size() << '\n';
  for (auto x : mv) cout << x << ' ';
  return 0;
}
