import sre_constants import sys sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (1, 0), (0, -1), (-1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = 10**19 # md = 998244353 md = 10**9+7 def solve(i, j): p1, q1 = pq[i] p2, q2 = pq[j] res = min(-p1+q1-p2, -p1) if d & 1: a = (-p1+q1-p2+q2)*(d//2)-p1 res = min(res, a) a += p1-q2 res = min(res, a) else: a = (-p1+q1-p2+q2)*(d//2)-q2 res = min(res, a) a += p2-q1 res = min(res, a) return res n, d = LI() pq = LLI(n) ans = -inf for i in range(n): for j in range(n): if i == j: continue ans = max(ans, solve(i, j)) print(ans)