import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  ps <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    step :: (Int, Int) -> Int -> (Int, Int)
    step acc@(c, m) p | p <= m     = (succ c, p)
                      | otherwise = acc
  print . fst . foldl step (0, n) $ ps

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
