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 maxn = 500010, inf = 1e9;
struct poi {
  int l, r, tim;
};
bool operator<(poi a, poi b) { return a.l < b.l || (a.l == b.l && a.r < b.r); }
set<poi> s;
vector<poi> v[maxn];
int n, K, l, r;
long long ans;
int cnt[maxn];
template <typename T>
inline void read(T &k) {
  int f = 1;
  k = 0;
  char c = getchar();
  while (c < '0' || c > '9') c == '-' && (f = -1), c = getchar();
  while (c <= '9' && c >= '0') k = k * 10 + c - '0', c = getchar();
  k *= f;
}
inline long long check(int mid) {
  for (int i = 1; i <= n; i++) cnt[i] = 0;
  int now = 0;
  long long sum = 0, nowsum = 0;
  for (int i = 1, j = 1; j <= n; j++) {
    for (int k = 0; k < v[j].size(); k++) {
      if (v[j][k].tim + 1 < i)
        nowsum += 1ll * (v[j][k].r - v[j][k].l + 1) * (i - v[j][k].tim - 1);
      if (v[j][k].tim + 1 <= i)
        now += v[j][k].r - v[j][k].l + 1;
      else
        cnt[v[j][k].tim + 1] += v[j][k].r - v[j][k].l + 1;
      cnt[j + 1] -= v[j][k].r - v[j][k].l + 1;
    }
    while (i <= j && now >= mid) nowsum += now, i++, now += cnt[i];
    sum += i - 1;
    ans += nowsum;
  }
  return sum;
}
int main() {
  read(n);
  read(K);
  s.insert((poi){1, inf, 0});
  for (int i = 1; i <= n; i++) {
    read(l);
    read(r);
    l++;
    set<poi>::iterator it1 = s.upper_bound((poi){l, inf, 0});
    it1--;
    for (set<poi>::iterator it = it1; it != s.end() && it->l <= r; it++)
      v[i].push_back((poi){max(l, it->l), min(r, it->r), it->tim});
    if (it1->l < l) s.insert((poi){it1->l, l - 1, it1->tim});
    set<poi>::iterator tmp;
    while (it1 != s.end() && it1->r <= r) {
      tmp = it1;
      it1++;
      s.erase(tmp);
    }
    if (it1 != s.end() && it1->l <= r)
      s.insert((poi){r + 1, it1->r, it1->tim}), s.erase(it1);
    s.insert((poi){l, r, i});
  }
  int l = 0, r = 1e9;
  while (l < r) {
    int mid = (l + r + 1) >> 1;
    ans = 0;
    if (check(mid) >= K)
      l = mid;
    else
      r = mid - 1;
  }
  ans = 0;
  long long tmp = check(l);
  printf("%lld\n", ans - (tmp - K) * l);
}
