{-# OPTIONS_GHC -O3 -fexpose-all-unfoldings -fdicts-cheap -fdicts-cheap #-}

import Data.Array
import Data.List (minimumBy)
import Data.Ord (comparing)

makeArray :: Int -> Array Int Int
makeArray n = listArray (1,n) [0,0..]

acmArray :: Array Int Int -> [(Int,Int)] -> Array Int Int
acmArray arr xs = accum (-) arr xs

listToTuple :: [Int] -> (Int,Int)
listToTuple [x,y] = (x,y)

tupleToString :: (Int,Int) -> String
tupleToString (x,y) = unwords [show x, show (-y)]

putresult arr x = do
  s' <- getLine
  let s = listToTuple $ map (read :: String -> Int) $ words s'
  let arr' = acmArray arr [s]
  putStrLn $ tupleToString $ minimumBy (comparing snd) (assocs arr') 
  if x < 2 then return ()
  else do
    putresult arr' (x-1)

main = do
  n' <- getLine
  let [n,x] = map read $ words n'
  let arr = makeArray n
  putresult arr x