Problem: Problem Statement

You are given a list of $N$ intervals. The $i$-th interval is $[l_i, r_i)$, which denotes a range of numbers greater than or equal to $l_i$ and strictly less than $r_i$. In this task, you consider the following two numbers:

* The minimum integer $x$ such that you can select $x$ intervals from the given $N$ intervals so that the union of the selected intervals is $[0, L)$.
* The minimum integer $y$ such that for all possible combinations of $y$ intervals from the given $N$ interval, it does cover $[0, L)$.



We ask you to write a program to compute these two numbers.

* * *

Input

The input consists of a single test case formatted as follows.

> $N$ $L$ $l_1$ $r_1$ $l_2$ $r_2$ $\vdots$ $l_N$ $r_N$

The first line contains two integers $N$ ($1 \leq N \leq 2 \times 10^5$) and $L$ ($1 \leq L \leq 10^{12}$), where $N$ is the number of intervals and $L$ is the length of range to be covered, respectively. The $i$-th of the following $N$ lines contains two integers $l_i$ and $r_i$ ($0 \leq l_i < r_i \leq L$), representing the range of the $i$-th interval $[l_i, r_i)$. You can assume that the union of all the $N$ intervals is $[0, L)$

Output

Output two integers $x$ and $y$ mentioned in the problem statement, separated by a single space, in a line.

Examples

Input| Output
---|---


3 3
0 2
1 3
1 2


|


2 3



2 4
0 4
0 4


|


1 1



5 4
0 2
2 4
0 3
1 3
3 4


|


2 4






Example

Input




Output

Solution (in CPP):

Solution:
/*  -*- coding: utf-8 -*-
 *
 * 2969.cc: Universal and Existential Quantifiers
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int MAX_M = MAX_N * 2;
const int MAX_E2 = 1 << 20; // = 1048576
const int INF = 1 << 30;

/* typedef */

typedef long long ll;
typedef vector<int> vi;

template <typename T, const int MAX_E2>
struct SegTreeMin {
  int n, e2;
  T nodes[MAX_E2], def;
  SegTreeMin() {}

  void init(int _n, T _def) {
    n = _n; def = _def;
    for (e2 = 1; e2 < n; e2 <<= 1);
    fill(nodes, nodes + MAX_E2, def);
  }

  T &get(int i) { return nodes[e2 - 1 + i]; }

  void set(int i, T v) {
    int j = e2 - 1 + i;
    nodes[j] = v;
    while (j > 0) {
      j = (j - 1) / 2;
      nodes[j] = min<T>(nodes[j * 2 + 1], nodes[j * 2 + 2]);
    }
  }

  T min_range(int r0, int r1, int k, int i0, int i1) {
    if (r1 <= i0 || i1 <= r0) return def;
    if (r0 <= i0 && i1 <= r1) return nodes[k];

    int im = (i0 + i1) / 2;
    T v0 = min_range(r0, r1, k * 2 + 1, i0, im);
    T v1 = min_range(r0, r1, k * 2 + 2, im, i1);
    return min<T>(v0, v1);
  }
  T min_range(int r0, int r1) { return min_range(r0, r1, 0, 0, e2); }
};

/* global variables */

ll ls[MAX_N], rs[MAX_N], xs[MAX_M];
vi nbrs[MAX_M];
SegTreeMin<int,MAX_E2> st;
int cs[MAX_M];

/* subroutines */

/* main */

int main() {
  int n;
  ll l;
  scanf("%d%lld", &n, &l);

  for (int i = 0, j = 0; i < n; i++) {
    scanf("%lld%lld", ls + i, rs + i);
    xs[j++] = ls[i];
    xs[j++] = rs[i];
  }

  sort(xs, xs + n * 2);
  int m = unique(xs, xs + n * 2) - xs;
  //printf("m=%d\n", m);

  for (int i = 0; i < n; i++) {
    int li = lower_bound(xs, xs + m, ls[i]) - xs;
    int ri = lower_bound(xs, xs + m, rs[i]) - xs;
    nbrs[li].push_back(ri);
    cs[li]++, cs[ri]--;
  }

  st.init(m, INF);
  st.set(0, 0);

  for (int i = 0; i < m; i++)
    if (! nbrs[i].empty()) {
      int d = st.min_range(i, m) + 1;
      vi &nbri = nbrs[i];
      for (vi::iterator vit = nbri.begin(); vit != nbri.end(); vit++) {
	int &j = *vit;
	if (st.get(j) > d) st.set(j, d);
      }
    }

  int minc = cs[0];
  for (int i = 1; i < m - 1; i++) {
    cs[i] += cs[i - 1];
    if (minc > cs[i]) minc = cs[i];
  }

  printf("%d %d\n", st.get(m - 1), n - (minc - 1));
  return 0;
}