Little D is a friend of Little C who loves intervals very much instead of number "3".

Now he has n intervals on the number axis, the i-th of which is [a_i,b_i].

Only the n intervals can not satisfy him. He defines the value of an interval of intervals [l,r] (1 ≤ l ≤ r ≤ n, l and r are both integers) as the total length of the union of intervals from the l-th to the r-th.

He wants to select exactly k different intervals of intervals such that the sum of their values is maximal. Please help him calculate the maximal sum.

Input

First line contains two integers n and k (1 ≤ n ≤ 3 ⋅ 10^5, 1 ≤ k ≤ min\{(n(n+1))/(2),10^9\}) — the number of intervals Little D has and the number of intervals of intervals he will select.

Each of the next n lines contains two integers a_i and b_i, the i-th line of the n lines describing the i-th interval (1 ≤ a_i < b_i ≤ 10^9).

Output

Print one integer — the maximal sum of values Little D can get.

Examples

Input

2 1
1 3
2 4


Output

3

Input

3 3
1 4
5 7
3 6


Output

15

Note

For the first example, Little D will select [1,2], the union of the first interval and the second interval is [1,4], whose length is 3.

For the second example, Little D will select [1,2], [2,3] and [1,3], the answer is 5+6+4=15.
#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
struct Tree {
  int l, r, num1;
  long long num2;
} T[N * 4];
struct Ask {
  int l, r, col;
  Ask(int _l = 0, int _r = 0, int _col = 0) {
    l = _l;
    r = _r;
    col = _col;
  }
  inline bool operator<(const Ask &b) const {
    return l < b.l || (b.l == l && r < b.r);
  }
};
set<Ask> S;
set<int> S2;
vector<int> v1[N << 1], v2[N << 1];
vector<pair<int, int> > A[N], B[N];
int l[N], r[N], a[N << 1], tot, n, k, R[N], L[N];
long long now, ppp;
inline int pd(int x) {
  long long now = 0, cnt = 0;
  for (int i = 1, j = 0; i <= n; i++) {
    if (i != 1) {
      for (pair<int, int> k : A[i - 1])
        if (k.first > j) now -= k.second;
    }
    while (now < x) {
      j++;
      for (pair<int, int> k : B[j])
        if (k.first < i) now += k.second;
    }
    cnt += n - j + 1;
    R[i] = j;
  }
  ppp = cnt - k;
  return cnt >= k;
}
inline int ef(int x) {
  int l = 1, r = tot;
  while (l < r) {
    int mid = (l + r) / 2;
    if (a[mid] < x)
      l = mid + 1;
    else
      r = mid;
  }
  return l;
}
inline void build(int x, int l, int r) {
  T[x].l = l;
  T[x].r = r;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(x * 2, l, mid);
  build(x * 2 + 1, mid + 1, r);
}
inline void insert(int x, int y, int z) {
  T[x].num1++;
  T[x].num2 += z;
  if (T[x].l == T[x].r) return;
  int mid = (T[x].l + T[x].r) / 2;
  if (y <= mid)
    insert(x * 2, y, z);
  else
    insert(x * 2 + 1, y, z);
}
inline long long find(int x, int l, int r, long long z) {
  if (T[x].l > r || l > T[x].r) return 0;
  if (T[x].l >= l && T[x].r <= r) return T[x].num1 * z - T[x].num2;
  return find(x * 2, l, r, z) + find(x * 2 + 1, l, r, z);
}
inline long long solve(int l, int r) {
  l++;
  return find(1, l, L[r], r);
}
inline void Insert(int x) {
  set<int>::iterator iter = S2.upper_bound(x), iter2 = iter;
  iter2--;
  now -= solve(*iter2, *iter);
  now += solve(*iter2, x);
  now += solve(x, *iter);
  S2.insert(x);
}
inline void Del(int x) {
  set<int>::iterator iter = S2.find(x), iter2 = iter;
  iter2--;
  iter++;
  now += solve(*iter2, *iter);
  now -= solve(*iter2, x);
  now -= solve(x, *iter);
  S2.erase(x);
}
signed main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d%d", &l[i], &r[i]), r[i]--;
  l[n + 1] = 1;
  r[n + 1] = 1e9;
  S.insert(Ask(1, 1e9, 0));
  for (int i = 1; i <= n + 1; i++) {
    set<Ask>::iterator iter = S.upper_bound(Ask(l[i], 1e9, 0));
    iter--;
    vector<Ask> add;
    add.push_back(Ask(l[i], r[i], i));
    for (; iter != S.end() && (*iter).l <= r[i];) {
      int len = min(r[i], (*iter).r) - max(l[i], (*iter).l) + 1;
      if ((*iter).col != 0) A[(*iter).col].push_back(make_pair(i, len));
      B[i].push_back(make_pair((*iter).col, len));
      if ((*iter).l < l[i])
        add.push_back(Ask((*iter).l, l[i] - 1, (*iter).col));
      if ((*iter).r > r[i])
        add.push_back(Ask(r[i] + 1, (*iter).r, (*iter).col));
      S.erase(iter++);
    }
    for (Ask j : add) S.insert(j);
  }
  int lll = 0, rrr = 1e9;
  while (lll < rrr) {
    int mid = (lll + rrr + 1) / 2;
    if (pd(mid))
      lll = mid;
    else
      rrr = mid - 1;
  }
  pd(lll);
  for (int i = 1; i <= n; i++) L[R[i]] = i;
  for (int i = 1; i <= n + 1; i++) L[i] = max(L[i - 1], L[i]);
  for (int i = 1; i <= n; i++) {
    r[i]++;
    a[++tot] = l[i];
    a[++tot] = r[i];
  }
  sort(a + 1, a + tot + 1);
  int num = 1;
  for (int i = 2; i <= tot; i++)
    if (a[i] != a[num]) a[++num] = a[i];
  tot = num;
  for (int i = 1; i <= n; i++)
    l[i] = ef(l[i]), r[i] = ef(r[i]), v1[l[i]].push_back(i),
    v2[r[i]].push_back(i);
  long long ans = 0;
  k = ppp;
  now = k;
  S2.insert(0);
  S2.insert(n + 1);
  build(1, 1, n);
  for (int i = 1; i <= n; i++) insert(1, i, R[i]);
  for (int i = 1; i < tot; i++) {
    for (int j : v1[i]) Insert(j);
    for (int j : v2[i]) Del(j);
    ans += (long long)(k - now) * (a[i + 1] - a[i]);
  }
  printf("%lld\n", ans - ppp * lll);
  return 0;
}
