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 = 4e5 + 5;
const int INF = 0x3f3f3f3f;
struct Node {
  int l, r, t;
  Node() = default;
  Node(int x, int y, int z = -1) : l(x), r(y), t(z) {}
  inline bool operator<(const Node &x) const { return r < x.r; }
};
struct Data {
  int id;
  long long val;
  Data() = default;
  Data(int x, long long y) : id(x), val(y) {}
};
set<Node> s;
vector<Data> dat[MAXN];
int n, k, l[MAXN], r[MAXN];
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
inline void prepare() {
  s.insert(Node(1, INF, 0));
  for (int i = 1; i <= n; i++) {
    auto x = s.lower_bound(Node(l[i], l[i]));
    auto y = s.upper_bound(Node(r[i], r[i]));
    auto tmp1 = *x, tmp2 = *y++;
    for (auto it = x; it != y; s.erase(it++))
      dat[i].push_back(Data(it->t, it->l - it->r));
    if (tmp1.l < l[i])
      s.insert(Node(tmp1.l, l[i], tmp1.t)),
          dat[i].push_back(Data(tmp1.t, l[i] - tmp1.l));
    if (tmp2.r > r[i])
      s.insert(Node(r[i], tmp2.r, tmp2.t)),
          dat[i].push_back(Data(tmp2.t, tmp2.r - r[i]));
    s.insert(Node(l[i], r[i], i));
    dat[i].push_back(Data(i, r[i] - l[i]));
  }
}
void solve(int lim, long long &cnt, long long &sum) {
  cnt = sum = 0;
  vector<long long> val(1, INF - 1);
  long long len = 0, pre = 0;
  for (int i = 1, j = 1; i <= n; i++) {
    val.push_back(0);
    for (auto x : dat[i]) {
      val[x.id] += x.val;
      if (x.id >= j)
        len += x.val;
      else
        pre += x.val * x.id;
    }
    while (i >= j && len >= lim) len -= val[j], pre += val[j] * j, j++;
    cnt += j - 1, sum += pre + len * (j - 1);
  }
}
int main() {
  n = read(), k = read();
  for (int i = 1; i <= n; i++) l[i] = read(), r[i] = read();
  prepare();
  int l = 1, r = INF;
  long long cnt, sum;
  while (l <= r) {
    int mid = (l + r) >> 1;
    solve(mid, cnt, sum);
    if (cnt < k)
      r = mid - 1;
    else
      l = mid + 1;
  }
  solve(r, cnt, sum);
  printf("%lld\n", sum - (cnt - k) * r);
  return 0;
}
