#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
long long n, l, x[N], d[N], t[N], p[N], dis[N], fix[N];
vector<int> vec, ans;
pair<int, int> par[N];
set<pair<long long, int>> s;
struct edge {
  long long v, id, w;
};
vector<edge> adj[N];
void solve() {
  memset(dis, 63, sizeof dis);
  s.insert({dis[0] = 0, 0});
  while (s.size()) {
    int u = s.begin()->second;
    s.erase(s.begin());
    for (auto [v, id, w] : adj[u])
      if (dis[v] > dis[u] + w) {
        s.erase({dis[v], v});
        s.insert({dis[v] = dis[u] + w, v});
        par[v] = {id, u};
      }
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> d[i] >> t[i] >> p[i];
    if (x[i] >= p[i]) {
      vec.push_back(x[i] - p[i]);
      vec.push_back(x[i] + d[i]);
    }
  }
  vec.push_back(0);
  vec.push_back(l);
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  for (int i = 0; i < n; i++)
    if (x[i] >= p[i]) {
      int u = lower_bound(vec.begin(), vec.end(), x[i] - p[i]) - vec.begin();
      int v = lower_bound(vec.begin(), vec.end(), x[i] + d[i]) - vec.begin();
      adj[u].push_back({v, i, p[i] + t[i]});
    }
  n = vec.size();
  for (int u = 1; u < n; u++) {
    adj[u].push_back({u - 1, -1, vec[u] - vec[u - 1]});
    adj[u - 1].push_back({u, -1, vec[u] - vec[u - 1]});
  }
  solve();
  for (int u = n - 1; u; u = par[u].second)
    if (~par[u].first) ans.push_back(par[u].first);
  cout << dis[vec.size() - 1] << endl << ans.size() << endl;
  reverse(ans.begin(), ans.end());
  for (int x : ans) cout << x + 1 << ' ';
}
