n,d=map(int,input().split()) p=[] q=[] for i in range(n): a,b=map(int,input().split()) p.append(a) q.append(b) ans=-2**64 for i in range(n): for j in range(n): if i==j:continue pi,qi=p[i],q[i] pj,qj=p[j],q[j] res=0 day=d res=min(-pi,-pi+qi-pj) go=((d-2)//2)*2 sub=(-pi+qi-pj+qj)*go day-=go for j in range(1,day+1): if j%2==1: sub-=pi res=min(res,sub) sub+=qi else: sub -= pj res = min(res, sub) sub += qj ans=max(ans,res) print(ans)