#include <bits/stdc++.h>
using namespace std;
using pa = pair<int, int>;
struct eage {
  int to;
  int time;
  int num;
  eage(int a, int b, int c) : to(a), time(b), num(c) {}
};
const int inf = INT_MAX - 1;
const int maxn = 3e5 + 7;
int pathto[maxn];
int num[maxn];
int t[maxn];
int d[maxn];
int vis[maxn];
vector<eage> eages[maxn];
int l[maxn];
int r[maxn];
int dis[maxn];
vector<int> nodes;
int main() {
  int n;
  int len;
  cin >> n >> len;
  nodes.push_back(0);
  nodes.push_back(len);
  for (int i = 1; i <= n; ++i) {
    int x, d, p;
    cin >> x >> d >> t[i] >> p;
    l[i] = x - p;
    r[i] = x + d;
    t[i] += p;
    if (l[i] < 0 || r[i] > len) continue;
    nodes.push_back(l[i]);
    nodes.push_back(r[i]);
  }
  map<int, int> f;
  sort(nodes.begin(), nodes.end(), [=](int a, int b) { return a < b; });
  nodes.resize(unique(nodes.begin(), nodes.end()) - nodes.begin());
  int len1 = nodes.size();
  for (int i = 0; i < len1; ++i) {
    f[nodes[i]] = i;
  }
  for (int i = 0; i < len1 - 1; ++i) {
    int fuck = nodes[i + 1] - nodes[i];
    eages[i].push_back(eage(i + 1, fuck, -1));
    eages[i + 1].push_back(eage(i, fuck, -1));
  }
  for (int i = 1; i <= n; ++i) {
    if (l[i] < 0 || r[i] > len) continue;
    eages[f[l[i]]].push_back(eage(f[r[i]], t[i], i));
  }
  priority_queue<pa, vector<pa>, greater<pa>> q;
  memset(vis, 0, sizeof vis);
  int len2 = nodes.size();
  for (int i = 0; i <= len2 + 2; ++i) {
    dis[i] = inf;
  }
  dis[0] = 0;
  q.push(pa(0, 0));
  while (!q.empty()) {
    int fuck = q.top().second;
    q.pop();
    if (vis[fuck]) continue;
    if (vis[len2 - 1]) break;
    vis[fuck] = 1;
    for (auto c : eages[fuck]) {
      int to = c.to;
      if (dis[to] > dis[fuck] + c.time) {
        dis[to] = dis[fuck] + c.time;
        pathto[to] = fuck;
        num[to] = c.num;
        q.push(pa(dis[to], c.to));
      }
    }
  }
  cout << dis[len2 - 1] << endl;
  int fuck = len2 - 1;
  vector<int> nums;
  while (fuck != 0) {
    if (num[fuck] != -1) nums.push_back(num[fuck]);
    fuck = pathto[fuck];
  }
  fuck = nums.size();
  cout << fuck << endl;
  fuck -= 1;
  while (fuck >= 0) {
    cout << nums[fuck] << " ";
    --fuck;
  }
}
