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;
inline int read() {
  int res = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = (res << 1) + (res << 3) + (ch ^ 48);
    ch = getchar();
  }
  return res * f;
}
const int N = 3e5 + 5, INF = 2e9;
int L[N], R[N];
int n;
struct seg {
  int l, r, id;
  seg() {}
  seg(int _l, int _r, int _id) : l(_l), r(_r), id(_id) {}
  friend inline bool operator<(const seg &a, const seg &b) {
    return a.l < b.l || (a.l == b.l && a.r < b.r);
  }
};
set<seg> s;
vector<seg> v[N];
inline void init() {
  s.insert(seg(0, INF, 0));
  for (int i = 1; i <= n; i++) {
    set<seg>::iterator it = s.lower_bound(seg(L[i], INF, 0));
    --it;
    seg tmp = *it;
    if (tmp.r >= R[i]) {
      v[i].push_back(seg(L[i], R[i], tmp.id));
      if (tmp.l < L[i]) s.insert(seg(tmp.l, L[i] - 1, tmp.id));
      if (tmp.r > R[i]) s.insert(seg(R[i] + 1, tmp.r, tmp.id));
      s.erase(it);
      s.insert(seg(L[i], R[i], i));
    } else {
      v[i].push_back(seg(L[i], tmp.r, tmp.id));
      if (tmp.l < L[i]) s.insert(seg(tmp.l, L[i] - 1, tmp.id));
      s.erase(it++);
      if ((*it).r < L[i]) ++it;
      while ((*it).r < R[i]) v[i].push_back(*it), s.erase(it++);
      v[i].push_back(seg((*it).l, R[i], (*it).id));
      if ((*it).r > R[i]) s.insert(seg(R[i] + 1, (*it).r, (*it).id));
      s.erase(it);
      s.insert(seg(L[i], R[i], i));
    }
  }
}
int k, mx, len[N];
inline bool check(int x) {
  int sum = 0, l = 1;
  long long cnt = 0;
  for (int i = 1; i <= n; i++) {
    sum += (len[i] = R[i] - L[i] + 1);
    for (int j = 0; j < v[i].size(); j++) {
      len[v[i][j].id] -= v[i][j].r - v[i][j].l + 1;
      if (v[i][j].id >= l) sum -= v[i][j].r - v[i][j].l + 1;
    }
    while (sum >= x) sum -= len[l], ++l;
    cnt += l - 1;
  }
  return cnt >= k;
}
inline long long calc(int x) {
  int sum = 0, l = 1;
  long long res = 0, cnt = 0, now = 0;
  for (int i = 1; i <= n; i++) {
    sum += (len[i] = R[i] - L[i] + 1);
    for (int j = 0; j < v[i].size(); j++) {
      len[v[i][j].id] -= v[i][j].r - v[i][j].l + 1;
      if (v[i][j].id >= l) sum -= v[i][j].r - v[i][j].l + 1;
      if (v[i][j].id && v[i][j].id < l)
        now -= 1ll * v[i][j].id * (v[i][j].r - v[i][j].l + 1);
    }
    while (sum >= x) sum -= len[l], now += 1ll * l * len[l], ++l;
    res += now + 1ll * sum * (l - 1);
    cnt += l - 1;
  }
  return res - 1ll * (cnt - k) * x;
}
int main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; i++) L[i] = read(), R[i] = read() - 1;
  init();
  int l = 1, r = INF, ans = 0;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid))
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  cout << calc(ans);
  return 0;
}
