var
a:array of int64;
k:array of int64;
i,n,s,r,sum:int64;
max1,max2:int64;
f1,f2:text;
begin
  assign(f1,'castle.in');
  assign(f2,'castle.out');
  reset(f1);
  max1:=0;
  max2:=0;
  readln(f1,n,s);
  a:=new int64[n];
  k:=new int64[n];
  for i:=0 to n-1 do begin
    readln(f1,a[i],k[i]);
    //записал макс позиции
    if k[i]>max1 then begin max2:=max1; max1:=k[i];end
    else if k[i]>max2 then max2:=k[i];
    //
  end;
  close(f1);
  while s<>0 do begin
    for i:=0 to n-1 do begin
      if k[i]=max1 then begin
        if a[i]div(k[i])>s then r:=s else r:=a[i]div(k[i]);
        //writeln('r = ',r);
        s:=s-r;
        a[i]:=a[i]-r*k[i];
        k[i]:=a[i];
      end else
      if (max2<k[i]) and (k[i]<max1) then max2:=k[i];
    end;
    max1:=max2;
    if max1 = 0 then break;
    max2:=0;
    
  end;
  //s закончились
  sum:=0;
  for i:=0 to n-1 do
  sum:=sum+a[i];
  rewrite(f2);
  writeln(f2,sum);
  close(f2);
end.