CF939B.Hamster Farm

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Dima has a hamsters farm. Soon NN hamsters will grow up on it and Dima will sell them in a city nearby.

Hamsters should be transported in boxes. If some box is not completely full, the hamsters in it are bored, that's why each box should be completely full with hamsters.

Dima can buy boxes at a factory. The factory produces boxes of KK kinds, boxes of the ii -th kind can contain in themselves aia_{i} hamsters. Dima can buy any amount of boxes, but he should buy boxes of only one kind to get a wholesale discount.

Of course, Dima would buy boxes in such a way that each box can be completely filled with hamsters and transported to the city. If there is no place for some hamsters, Dima will leave them on the farm.

Find out how many boxes and of which type should Dima buy to transport maximum number of hamsters.

输入格式

The first line contains two integers NN and KK ( 0<=N<=10180<=N<=10^{18} , 1<=K<=1051<=K<=10^{5} ) — the number of hamsters that will grow up on Dima's farm and the number of types of boxes that the factory produces.

The second line contains KK integers a1a_{1} , a2a_{2} , ..., aKa_{K} ( 1<=ai<=10181<=a_{i}<=10^{18} for all ii ) — the capacities of boxes.

输出格式

Output two integers: the type of boxes that Dima should buy and the number of boxes of that type Dima should buy. Types of boxes are numbered from 11 to KK in the order they are given in input.

If there are many correct answers, output any of them.

输入输出样例

  • 输入#1

    19 3
    5 4 10
    

    输出#1

    2 4
    
  • 输入#2

    28 3
    5 6 30
    

    输出#2

    1 5
    
首页