#include <bits/stdc++.h>
const double pi = acos(-1.0);
const double eps = 1e-9;
using namespace std;
const int INF = 1e9;
const int N = 3e5 + 1;
vector<pair<int, int>> g[N];
int from[N], x[N], d[N], t[N], p[N];
void solve() {
  int n, l, v;
  cin >> n >> l;
  v = 0;
  vector<pair<int, int>> id;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> d[i] >> t[i] >> p[i];
    if (x[i] - p[i] < 0) continue;
    id.push_back({x[i] - p[i], ++v});
    from[v] = i;
    id.push_back({x[i] + d[i], ++v});
    from[v] = i;
    g[v - 1].push_back({v, t[i] + p[i]});
  }
  int zero = v + 1, last = v + 2;
  v += 2;
  id.push_back({0, zero});
  id.push_back({l, last});
  sort(id.begin(), id.end());
  for (int i = 0; i < id.size(); i++) {
    if (i - 1 >= 0)
      g[id[i].second].push_back(
          {id[i - 1].second, id[i].first - id[i - 1].first});
    if (i + 1 < id.size())
      g[id[i].second].push_back(
          {id[i + 1].second, id[i + 1].first - id[i].first});
  }
  int s = zero;
  vector<int> dist(v + 1, INF), pp(v + 1);
  dist[s] = 0;
  set<pair<int, int>> q;
  q.insert({dist[s], s});
  while (!q.empty()) {
    int u = q.begin()->second;
    q.erase(q.begin());
    for (int j = 0; j < g[u].size(); j++) {
      int to = g[u][j].first;
      int len = g[u][j].second;
      if (dist[u] + len < dist[to]) {
        q.erase({dist[to], to});
        dist[to] = dist[u] + len;
        pp[to] = u;
        q.insert({dist[to], to});
      }
    }
  }
  cout << dist[last] << endl;
  vector<int> ans;
  while (true) {
    if (from[last] == from[pp[last]] && from[last] > 0 &&
        d[from[last]] > t[from[last]])
      ans.push_back(last);
    last = pp[last];
    if (last == zero || last == 0) break;
  }
  cout << ans.size() << endl;
  reverse(ans.begin(), ans.end());
  for (int x : ans) cout << from[x] << " ";
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  int step;
  step = 1;
  for (int i = 1; i <= step; i++) {
    solve();
  }
}
