Dima has a hamsters farm. Soon N 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 K kinds, boxes of the i-th kind can contain in themselves a_{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.


-----Input-----

The first line contains two integers N and K (0 ≤ N ≤ 10^18, 1 ≤ 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 K integers a_1, a_2, ..., a_{K} (1 ≤ a_{i} ≤ 10^18 for all i) — the capacities of boxes.


-----Output-----

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 1 to K in the order they are given in input.

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


-----Examples-----
Input
19 3
5 4 10

Output
2 4

Input
28 3
5 6 30

Output
1 5

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(box, num) = (0, 0)
mod = n + 1
for i in range(k):
	m = n % a[i]
	if m < mod:
		mod = m
		box = i + 1
		num = n // a[i]
print(box, num)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
min_residue = n
box_type = 0
box_number = 0
for i in range(k):
	if n % a[i] <= min_residue:
		min_residue = n % a[i]
		box_type = i + 1
		box_number = n // a[i]
print(box_type, box_number)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [n % x for x in a]
x = b.index(min(b))
print(x + 1, n // a[x])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
x = n % a[0]
typ = 0
for i in range(1, k):
	temp = n % a[i]
	if temp < x:
		typ = i
		x = temp
print(typ + 1, (n - x) // a[typ])


(n, k) = map(int, input().split())
box_type = -1
ans_so_far = 99999999999999999999999
ans = 0
keys = [int(i) for i in input().split()]
for i in range(k):
	if n % keys[i] < ans_so_far:
		ans_so_far = n % keys[i]
		box_type = i + 1
		ans = n // keys[i]
print(box_type, ans)


R = lambda : map(int, input().split())
(n, m) = R()
a = list(R())
ans = float('inf')
ans_i = 0
for i in range(m):
	temp = n % a[i]
	if temp < ans:
		ans = temp
		ans_i = i
print(ans_i + 1, n // a[ans_i])


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
ma = 0
ma_index = 1
for (index, capacity) in enumerate(a, start=1):
	if ma < n // capacity * capacity:
		ma = n // capacity * capacity
		ma_index = index
print(ma_index, ma // a[ma_index - 1])


from collections import defaultdict
import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def listinput():
	return list(map(int, input().split()))
(n, k) = minput()
a = listinput()
p = [' ' for _ in range(k)]
for i in range(k):
	p[i] = n // a[i] * a[i]
print(p.index(max(p)) + 1, n // a[p.index(max(p))])


import sys, bisect
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
idx = 0
ans = 0
boxes = 0
for i in range(k):
	temp = n // arr[i] * arr[i]
	if temp > ans:
		idx = i
		ans = temp
		boxes = n // arr[i]
print(idx + 1, boxes)


t1 = list(map(int, input().split()))
t2 = list(map(int, input().split()))
count = t1[0] // t2[0]
j = 0
temp = t1[0] % t2[0]
for i in range(t1[1]):
	temp1 = t1[0] % t2[i]
	if temp1 < temp:
		temp = temp1
		j = i
		count = t1[0] // t2[i]
print(j + 1, count)


(a, b) = input().split()
a = int(a)
b = int(b)
ar = [int(x) for x in input().split()]
h = a % ar[0]
ii = 0
fin = a // ar[0]
for i in range(1, b):
	res = a % ar[i]
	if res < h:
		fin = a / ar[i]
		fin = int(fin)
		ii = i
		h = res
print(ii + 1, fin)


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
mx = 0
index = 1
for i in range(k):
	lefthams = n // a[i] * a[i]
	if lefthams > mx:
		mx = lefthams
		index = i + 1
print(index, n // a[index - 1])


(n, k) = [int(x) for x in input().split()]
res_i = 0
res_val = 0
res_mod = n
i = 0
try:
	for t in map(int, input().split()):
		i += 1
		if res_mod > n % t:
			res_i = i
			res_val = t
			res_mod = n % t
	if n == 0 or res_val == 0:
		print('1 0')
	else:
		print(res_i, n // res_val)
except Exception as e:
	print(e)


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
left = 9999999999999999999999999999
idx = -1
for i in range(0, k):
	if n % l[i] < left:
		left = n % l[i]
		idx = i
idx += 1
print(str(idx) + ' ' + str(n // l[idx - 1]))


(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
ans = a = b = 0
mi = 1000000000000000000000000
for i in range(k):
	rem = n % lis[i]
	if rem < mi:
		mi = rem
		a = i
print(a + 1, n // lis[a])


def read_nums():
	return [int(x) for x in input().split()]

def get_res(num_hamsters, box_sizes):
	(min_index, res_box_size, min_left) = (0, box_sizes[0], num_hamsters % box_sizes[0])
	for (index, box_size) in enumerate(box_sizes):
		cur_left = num_hamsters % box_size
		if cur_left < min_left:
			min_left = cur_left
			min_index = index
			res_box_size = box_size
	return (min_index, num_hamsters // res_box_size)

def main():
	(num_hamsters, num_box_types) = read_nums()
	box_sizes = read_nums()
	(box_index, num_boxes) = get_res(num_hamsters, box_sizes)
	print(box_index + 1, num_boxes)

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
a = list(map(int, input().split()))
(m, type, num) = (N + 1, -1, -1)
for (i, el) in enumerate(a, 1):
	temp = N % el
	if temp < m:
		m = temp
		type = i
		num = N // el
print(type, num)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
t = [n % i for i in l]
print(t.index(min(t)) + 1, n // l[t.index(min(t))])


import math

def solve():
	(n, k) = [int(x) for x in input().split(' ')]
	size = [int(x) for x in input().split(' ')]
	Min = float('inf')
	num = 0
	for i in range(k):
		if n - n // size[i] * size[i] < Min:
			Min = n - n // size[i] * size[i]
			pos = i + 1
			num = n // size[i]
	print(pos, num)
	return
solve()


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
tp = [n if i > n else n % i for i in l]
mn = min(tp)
m = tp.index(mn)
print(m + 1, n // l[m])


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
min1 = 1000000000000000000
if n == 0:
	print('1', end=' ')
	print('0')
else:
	for i in range(k):
		if n % lst[i] < min1:
			min1 = n % lst[i]
			ind = i + 1
			num = n // lst[i]
	print(ind, end=' ')
	print(num)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
min = n
minInd = 1
for (i, t) in enumerate(arr):
	if n % t < min:
		min = n % t
		minInd = i + 1
print(minInd, n // arr[minInd - 1])


(k, n) = map(int, input().split())
a = [int(x) for x in input().split()]
typ = 0
left = k % a[0]
for i in range(1, n):
	if k % a[i] < left:
		left = k % a[i]
		typ = i
print(typ + 1, end=' ')
print(k // a[typ])


def farm(n, k, l):
	res = []
	for i in range(0, len(l)):
		res.append(n % l[i])
	v = min(res)
	for i in range(0, len(res)):
		if v == res[i]:
			print(i + 1, end=' ')
			print(n // l[i])
			break
(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
farm(n, k, l)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
mn = n
for i in range(k):
	if n % a[i] == 0:
		ans = [i + 1, n // a[i]]
		break
	elif a[i] > n and mn == n:
		ans = [i + 1, 0]
	elif n % a[i] < mn:
		mn = n % a[i]
		ans = [i + 1, n // a[i]]
print(*ans)


(N, K) = [int(x) for x in input().split()]
lsta = [int(x) for x in input().split()]
maxdiff = 9999999999999999999999
ind = 0
for i in range(K):
	z = N // lsta[i]
	num = N - z * lsta[i]
	if num < maxdiff:
		maxdiff = num
		kol = z
		ind = i
print(ind + 1, kol)


(N, K) = map(int, input().split())
mas = list(map(int, input().split()))
k = 100000000000000000000000000000000000000000000000000000000000000
kolich = None
ind = None
for korobka in mas:
	if N % korobka < k:
		k = N % korobka
		ind = mas.index(korobka) + 1
		kolich = N // korobka
print(ind, kolich)


rd = lambda : map(int, input().split())
(n, k) = rd()
(p, q) = min(enumerate(rd()), key=lambda x: n % x[1])
print(p + 1, n // q)


(n, k) = map(int, input().split())
lst = []
for x in input().split():
	lst.append(int(x))
r = n + 1
for x in range(len(lst)):
	if n % lst[x] < r:
		r = n % lst[x]
		t = x
print(t + 1, n // lst[t])


(n, k) = map(int, input().split())
cap = list(map(int, input().split()))
(a, b, r) = (-1, -1, 10 ** 18)
for i in range(k):
	capacity = cap[i]
	rem = n % capacity
	if rem == 0:
		a = i + 1
		break
	elif rem < r:
		a = i + 1
		r = rem
print(a, n // cap[a - 1])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [n - n % x for x in a]
i = b.index(max(b))
print(i + 1, n // a[i])


import math
import os
import random
import re
import sys
import functools
from operator import itemgetter, attrgetter
from collections import Counter
Y = lambda : list(map(int, input().split()))
P = lambda : map(int, input().split())
N = lambda : int(input())
(n, k) = P()
a = Y()
p = 0
for i in range(k):
	if n % a[i] < n % a[p]:
		p = i
print('%s %s' % (p + 1, n // a[p]))


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in range(k):
	x = int(n % a[i])
	d[a[i]] = x
minv = min(d.values())
key_list = list(d.keys())
val_list = list(d.values())
m = key_list[val_list.index(minv)]
z = n // m
print(a.index(m) + 1, math.floor(z))


s = input()
(n, k) = list(map(int, s.split()))
s = input()
a = list(map(int, s.split()))
(best, d) = (1, n % a[0])
for (i, x) in enumerate(a):
	if n % x < d:
		best = i + 1
		d = n % x
print(best, n // a[best - 1])


(n, k) = map(int, input().split())
ar = list(map(int, input().split()))
ans = n % ar[0]
index = 0
for i in range(1, k):
	if n % ar[i] < ans:
		ans = n % ar[i]
		index = i
print(index + 1, n // ar[index])


(N, K) = [int(k) for k in input().split()]
v = [int(k) for k in input().split()]
buy = -1
mmod = 1000000000000000000000
idx = -1
for ii in range(K):
	i = v[ii]
	chk = N % i
	if chk < mmod:
		buy = N // i
		idx = ii + 1
		mmod = chk
print(idx, buy)


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
mi = max(L) + 1
res = 0
for i in range(k):
	p = n % L[i]
	if p < mi:
		mi = p
		res = i + 1
print(res, n // L[res - 1])


(n, k) = list(map(int, input().split()))
m = min([(n % v, i, v) for (i, v) in enumerate(map(int, input().split()), 1)])
print(m[1], n // m[2])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = []
c = 0
for i in range(k):
	if n // a[i] * a[i] > c:
		c = n // a[i] * a[i]
		s = [i + 1, n // a[i]]
if not s:
	print(a.index(min(a)) + 1, 0)
else:
	print(*s)


(n, k) = map(int, input().split())
a = [int(_) for _ in input().split()]
w = 10 ** 18 + 1
for i in range(k):
	if n % a[i] < w:
		w = n % a[i]
		ty = i + 1
		nb = n // a[i]
print(ty, nb)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = l.index(min(l, key=lambda x: n % int(x)))
print(s + 1, n // l[s])


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
x = 0
y = 10 ** 18
for i in range(k):
	if n % a[i] < y:
		y = n % a[i]
		x = i + 1
print(x, n // a[x - 1])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list()
c = list()
for i in range(0, k):
	b.append(n // a[i])
	c.append(n % a[i])
val = min(c)
idx = c.index(val)
print(idx + 1, b[idx])


(n, k) = input().split()
n = int(n)
k = int(k)
a = input().split()
b = []
c = []
for i in range(k):
	a[i] = int(a[i])
	b.append(n % a[i])
	c.append(n // a[i])
print(b.index(min(b)) + 1, c[b.index(min(b))])


IL = lambda : list(map(int, input().split()))
I = lambda : int(input())
(n, k) = IL()
a = IL()
m = sorted([[n % a[i], i] for i in range(k)])
print(m[0][1] + 1, n // a[m[0][1]])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
	b.append(n % a[i])
min1 = min(b)
ind = b.index(min1)
print(ind + 1, n // a[ind])


(n, k) = map(int, input().split())
c = k
y = []
x = [int(x) for x in input().split()]
if n == 0:
	print('1 0')
	exit()
else:
	for i in range(k):
		j = n % x[i]
		y.append(j)
	print(1 + y.index(min(y)), n // x[y.index(min(y))])


from sys import stdin
from math import gcd
inp = stdin.readline
(n, k) = [int(x) for x in inp().strip().split()]
array = [int(x) for x in inp().strip().split()]
typeOfBoxes = 1
numberOfBoxes = n // array[0]
for i in range(1, k):
	if n % array[i] < n % array[typeOfBoxes - 1]:
		typeOfBoxes = i + 1
		numberOfBoxes = n // array[i]
print(typeOfBoxes, numberOfBoxes)


a = input().split()
l = input().split()
min1 = int(a[0]) % int(l[0])
k = 0
b = int(a[0]) // int(l[0])
for i in range(1, int(a[1])):
	if int(a[0]) % int(l[i]) < min1:
		min1 = int(a[0]) % int(l[i])
		k = i
		b = int(a[0]) // int(l[i])
print(str(k + 1) + ' ' + str(b))


(n, k) = map(int, input().split())
list = [int(i) for i in input().split()]
temp = []
for i in range(k):
	temp.append(n % list[i])
(small, i) = (min(temp), 0)
while i < k:
	if small == temp[i]:
		break
	i += 1
print(i + 1, int(n // list[i]))


def readInts():
	return list(map(int, input().split()))

def readInt():
	return int(input())

def readIntsindex0():
	return list(map(lambda x: int(x) - 1, input().split()))
(n, k) = readInts()
a = readInts()
best = -1
sel = -1
for i in range(k):
	cur = n - n % a[i]
	if best < cur:
		best = cur
		sel = i
print('%d %d' % (sel + 1, n // a[sel]))


import sys, math
f = sys.stdin
(N, K) = list(map(int, f.readline().split()))
box_size = list(map(int, f.readline().split()))
ans = -1
ans_cnt = 0
ans_type = 0
for (i, b) in enumerate(box_size):
	num_box = N // b
	if ans < num_box * b:
		ans = num_box * b
		ans_cnt = num_box
		ans_type = i + 1
print(ans_type, ans_cnt)


def func():
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	i = 1
	type_box = 1
	no_boxes = n // a[0]
	left_hamsters = n % a[0]
	while i < k:
		l = n % a[i]
		if l < left_hamsters:
			type_box = i + 1
			no_boxes = n // a[i]
			left_hamsters = l
		i += 1
	return '%s %s' % (type_box, no_boxes)
print(func())


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
max = -1
box = 0
type = 0
for i in range(k):
	temp = n - n % li[i]
	if temp > max:
		type = i + 1
		box = temp // li[i]
		max = temp
print(type, box)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
mx = 1e+18
index = -1
ans = -1
for i in range(len(lst)):
	if n % lst[i] < mx:
		mx = n % lst[i]
		index = i + 1
		ans = n // lst[i]
if index == -1:
	print(1, 0)
else:
	print(index, ans)


(n, k) = list(map(int, input().split()))
ai = list(map(int, input().split()))
q = float('inf')
qt = 0
for i in ai:
	if n % i < q:
		q = n % i
		qt = ai.index(i)
print(qt + 1, n // ai[qt])


(z, zz, dgraphs, mod) = (input, lambda : list(map(int, z().split())), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, m) = zz()
l = zz()
t = []
ans = []
for i in l:
	t.append(n // i * i)
	ans.append(i)
x = max(t)
p = t.index(x)
print(p + 1, n // ans[p])


[n, k] = list(map(int, input().split()))
arr = list(map(int, input().split()))
sol = -1
ans = [0, 0]
for i in range(k):
	num = n // arr[i]
	tot = arr[i] * num
	sol = max(sol, tot)
	if sol == tot:
		ans = [i + 1, num]
print(*ans)


(n, k) = [int(z) for z in input().split()]
a = [int(z) for z in input().split()]
best = 10000000000000000000
for i in range(k):
	if n % a[i] < best:
		best = n % a[i]
		num = n // a[i]
		kor = i + 1
print(kor, num)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
r = []
m = 10 ** 18
ans = 0
ci = -1
for i in range(k):
	t = n % a[i]
	if t < m:
		ans = n // a[i]
		m = t
		ci = i
print(f'{ci + 1} {ans}')


s = input()
(n, m) = list(map(int, s.split()))
s = input()
l = list(map(int, s.split()))
remain = n
model = 1
count = 0
for i in range(0, m):
	q = n % l[i]
	if q < remain:
		remain = q
		model = i + 1
		count = n // l[i]
print(model, count)


x = [int(n) for n in input().split()]
s = [int(n) for n in input().split()]
z = [x[0] % n for n in s]
k = z.index(min(z))
print(k + 1, x[0] // s[k])


import sys, operator
a = [int(x) for x in sys.stdin.readline().split(' ')]
b = [int(x) for x in sys.stdin.readline().split(' ')]
boxes = {}
for i in range(len(b)):
	boxes[i] = b[i]
best = [float('inf')]
for i in range(len(b)):
	if a[0] % b[i] < best[0]:
		best = [a[0] % b[i], b[i]]
print(operator.indexOf(b, best[1]) + 1, (a[0] - best[0]) // best[1])
sys.exit()


(N, K) = map(int, input().split())
x = list(map(int, input().split()))
min_dif = 10 ** 19
min_index = 0
for i in range(K):
	if N % x[i] < min_dif:
		min_dif = N % x[i]
		min_index = i + 1
print(min_index, N // x[min_index - 1])


import atexit
import io
import sys
import os
inf = float('inf')
inf_neg = float('-inf')
range_5 = int(100000.0 + 1)
range_6 = int(1000000.0 + 1)
range_7 = int(10000000.0 + 1)
range_8 = int(100000000.0 + 1)
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def main():
	(N, K) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = -1
	t = tuple()
	for i in range(K):
		r = N // arr[i]
		value = r * arr[i]
		if value > ans:
			t = (i + 1, r)
			ans = value
	print(t[0], t[1])
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(answer, amount) = (-1, -1)
for i in range(k):
	x = n // a[i] * a[i]
	if x > amount:
		answer = i + 1
		amount = x
print(answer, amount // a[answer - 1], end=' ')


s1 = input().split()
s2 = input().split()
n = int(s1[0])
k = int(s1[1])
cl = []
for i in s2:
	cl.append(int(i))
mn = n
res = (0, 0)
for i in range(k):
	ost = n % cl[i]
	if ost < mn:
		mn = ost
		res = (i + 1, n // cl[i])
if res == (0, 0):
	print('1 0')
else:
	print('{} {}'.format(res[0], res[1]))


(N, K) = (int(i) for i in input().split())
typ = [int(i) for i in input().split()]
diff_min = pow(10, 19)
many = N // typ[0]
opt_typ = 1
for b in range(K):
	tmp_many = N // typ[b]
	tmp_diff = N - tmp_many * typ[b]
	if tmp_diff < diff_min:
		diff_min = tmp_diff
		many = tmp_many
		opt_typ = b + 1
print(opt_typ, many)


def __starting_point():
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	m = 10000000000000000000
	j = 0
	c = 0
	for i in range(K):
		k = N % A[i]
		if k < m:
			m = k
			c = N // A[i]
			j = i + 1
	print(j, c)
__starting_point()


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ma = 0
for i in range(k):
	if n % l[i] < n % l[ma]:
		ma = i
print(ma + 1, n // l[ma])


s = input().split(' ')
a = input().split(' ')
n = int(s[0])
k = int(s[1])
lis = []
for i in range(k):
	lis.append([n % int(a[i]), n // int(a[i]), i])
lis.sort()
print(lis[0][2] + 1, lis[0][1])


(n, k) = map(int, input().split())
if n == 0:
	print('1 0')
	exit()
a = list(map(int, input().split()))
box = 0
for i in range(1, k):
	box = box if n % a[box] < n % a[i] else i
print(box + 1, n // a[box])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(ans, j) = (n % a[0], 1)
for i in range(1, k):
	tmp = n % a[i]
	if ans > tmp:
		ans = tmp
		j = i + 1
	if ans == 0:
		break
print(j, n // a[j - 1])


(n, k) = [int(i) for i in input().split(' ')]
A = [int(i) for i in input().split(' ')]
mx = 0
mxval = 0
for i in range(k):
	if A[i] * (n // A[i]) > mxval:
		mxval = A[i] * (n // A[i])
		mx = i
print(mx + 1, n // A[mx])


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
typ = 1
num = n // a[0]
tot = num * a[0]
for i in range(1, len(a)):
	if n // a[i] * a[i] > tot:
		typ = i + 1
		tot = n // a[i] * a[i]
print(typ, n // a[typ - 1])


import math
m = math.inf
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
mi = [0] * k
for i in range(k):
	mi[i] = n % a[i]
l = 0
for i in range(k):
	if mi[i] < m:
		m = mi[i]
		l = i
print(l + 1, n // a[l])


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
a = []
for i in range(k):
	a.append(n % l[i])
print(a.index(min(a)) + 1, n // l[a.index(min(a))])


(n, k) = [int(x) for x in input().split()]
size = [int(x) for x in input().split()]
mn = n + 1
t = 0
num = 0
for i in range(k):
	if n % size[i] < mn:
		mn = n % size[i]
		t = i + 1
		num = n // size[i]
print(t, num)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
p = n // arr[0]
u = arr[0] * p
j = 1
jj = p
for i in range(1, k):
	pp = n // arr[i]
	uu = arr[i] * pp
	if uu > u:
		j = i + 1
		jj = pp
		u = uu
print(j, jj)


(n, k) = [int(i) for i in input().split()]
list1 = [int(i) for i in input().split()]
prev_rem = n
for item in range(len(list1)):
	remainder = n % list1[item]
	if remainder <= prev_rem:
		prev_rem = remainder
		ans = item + 1
print(ans, n // list1[ans - 1])


import math
from decimal import *

def HamsterFarm(n, k, a):
	getcontext().prec = 28
	totalCnt = 0
	index = 0
	minCnt = n
	maxCnt = 0
	i = 0
	for t in a:
		possibleNum = math.floor(Decimal(n) / Decimal(t))
		totalCnt = n % t
		if totalCnt < minCnt:
			maxCnt = possibleNum
			index = i + 1
			minCnt = totalCnt
		i += 1
	if index == 0:
		index = 1
	return (index, maxCnt)
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
(index, cnt) = HamsterFarm(n, k, a)
print(str(index) + ' ' + str(cnt))


def I():
	return int(input())

def IL():
	return [int(i) for i in input().split()]

def IM():
	return map(int, input().split())

def IS():
	return input()
(n, k) = IM()
l = IL()
mini = 10 ** 89
for i in range(k):
	if n % l[i] < mini:
		m1 = i + 1
		m = l[i]
		mini = n % l[i]
print(m1, n // m)


(N, K) = map(int, input().split())
a = list(map(int, input().split()))
num = 0
t = 0
b = []
for i in a:
	b.append(N % i)
t = 1
for i in range(0, K):
	if b[t - 1] > b[i]:
		t = i + 1
num = N // a[t - 1]
print(t, num)


[n, m] = input().split(' ')
n = int(n)
m = int(m)
line = input().split(' ')
a = []
for i in range(m):
	a.append(int(line[i]))
ans = 0
minn = 1e+18
for i in range(m):
	if n % a[i] < minn:
		minn = n % a[i]
		ans = i + 1
if ans != 0:
	print('{} {}'.format(ans, n // a[ans - 1]))
else:
	print('{} {}'.format(1, n // a[ans - 1]))


(N, K) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
(r, d, min_res, res) = ([0, 0], 0, float('inf'), 0)
for (index, i) in enumerate(a):
	(d, res) = divmod(N, i)
	if res < min_res:
		min_res = res
		r = [index + 1, d]
r += ['\n']
for (index, i) in enumerate(r):
	if index == len(r) - 1:
		print(i, end='')
	else:
		print(str(i) + ' ', end='')


(n, k) = map(int, input().split(' '))
arr = list(map(int, input().split(' ')))
minn = n % arr[0]
a1 = 1
a2 = n // arr[0]
for i in range(1, k):
	x = n % arr[i]
	if x < minn:
		a1 = i + 1
		a2 = n // arr[i]
		minn = x
print(str(a1) + ' ' + str(a2))


(N, K) = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
best = int(1e+18) + 1
besti = -1
for i in range(K):
	r = N % a[i]
	if r < best:
		best = r
		besti = i
print(besti + 1, N // a[besti])


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
v = n % arr[0]
kind = 1
for i in range(1, k):
	if n % arr[i] < v:
		v = n % arr[i]
		kind = i + 1
number = n // arr[kind - 1]
print(kind, number)


t = list(map(int, input().split(' ')))
n = t[0]
k = list(map(int, input().split(' ')))
a = n % k[0]
b = n // k[0]
c = 1
for i in k:
	if a > n % i:
		a = n % i
		b = n // i
		c = k.index(i) + 1
print(c, ' ', b)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
t = [n % i for i in l]
mi = min(t)
ind = t.index(mi)
print(ind + 1, n // l[ind])


(a, b) = (int(x) for x in input().split())
c = [int(x) for x in input().split()]
type = 1
num = a // c[0]
rest = a % c[0]
for i in range(b):
	re = a % c[i]
	if re < rest:
		rest = re
		type = i + 1
		num = a // c[i]
print('%d %d' % (type, num))


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
ans = 0
box = 0
for i in range(k):
	new = n // L[i] * L[i]
	if new > ans:
		ans = new
		box = i
print(box + 1, n // L[box])


(nrHamsters, nrBoxSizes) = map(int, input().split())
boxsizes = list(map(int, input().split()))
nrHamstersMax = 0
boxSizeIndex = 0
for boxsize in boxsizes:
	nrHamstersCandidate = nrHamsters // boxsize * boxsize
	boxSizeIndex += 1
	if nrHamstersCandidate >= nrHamstersMax:
		nrHamstersMax = nrHamstersCandidate
		nrBoxesMax = nrHamsters // boxsize
		boxSizeIndexMax = boxSizeIndex
print(str(boxSizeIndexMax) + ' ' + str(nrBoxesMax))


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
me = float('inf')
i = 0
for o in range(k):
	kw = A[o]
	if me > n % kw:
		me = n % kw
		i = o
print(1 + i, n // A[i])


(n, k) = map(int, input().split())
data = [int(i) for i in input().split()]
res = []
for i in data:
	res.append(n % i)
print(res.index(min(res)) + 1, n // data[res.index(min(res))])


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
m1 = n
m2 = 0
p = 0
if n == 0:
	print(1, 0)
else:
	for i in range(0, k, 1):
		if n // int(l[i]) > 0 and n % int(l[i]) < m1:
			m1 = n % int(l[i])
			p = i
	print(p + 1, n // int(l[p]))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = min(enumerate(a), key=lambda x: n % x[1])
print(m[0] + 1, n // m[1])


(n, k) = [int(n) for n in input().split()]
arr = [int(item) for item in input().split()]
j = 0
mini = n % arr[0]
for i in range(1, k):
	if n % arr[i] < mini:
		mini = n % arr[i]
		j = i
print(j + 1, n // arr[j])


(N, K) = map(int, input().split())
a = list(map(int, input().split()))
x = N + 1
for i in range(K):
	if N % a[i] < x:
		x = N % a[i]
		ii = i + 1
		n = N // a[i]
print(ii, n)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
temp = n + 1
for i in l:
	if n % i < temp:
		temp = n % i
		ind = l.index(i)
		ans = n // i
print(ind + 1, ans)


(n, k) = map(int, input().strip().split())
boxes = [int(x) for x in input().strip().split()]
if n == 0:
	print(1, 0)
elif len(boxes) == 1:
	if boxes[0] <= n:
		print(1, n // boxes[0])
	else:
		print(1, 0)
else:
	bbox = []
	for box in boxes:
		if box <= n:
			bbox.append(n % box)
		else:
			bbox.append(box)
	box_idx = bbox.index(min(bbox))
	num_boxes = n // boxes[box_idx]
	box_num = box_idx + 1
	print(box_num, num_boxes)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
if n < min(a):
	print('1 0')
	quit()
mr = 1e+19
mi = -1
for j in range(k):
	i = a[j]
	r = n % i
	if r < mr:
		mr = r
		mi = j
print(mi + 1, n // a[mi])


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
p = []
for i in range(len(a)):
	p.append(n % a[i])
b = p.index(min(p))
c = int(n / a[b])
if c * a[b] <= n:
	print(b + 1, c)
else:
	print(b + 1, c - 1)


(n, k) = map(int, input().split())
max = 0
maxk = 0
maxi = 1
niz = list(map(int, input().split()))
for i in range(k):
	kutija = niz[i]
	if kutija > n:
		continue
	brk = n // kutija
	brh = brk * kutija
	if brh > max:
		max = brh
		maxk = brk
		maxi = i + 1
print('{} {}'.format(maxi, maxk))


import sys
(n, k) = input().split()
(n, k) = [int(n), int(k)]
a = list(map(int, input().split()))
m = 1000000000000000000000000
d = {}
s = set()
for i in range(k):
	if a[i] not in s:
		s.add(a[i])
		d[a[i]] = 1
	else:
		d[a[i]] = d[a[i]] + 1
	if n == 0:
		ans = 0
		print(1, end=' ')
		print(0)
		sys.exit(0)
	if n % a[i] < m:
		m = n % a[i]
		ans = i
		res = a[ans]
	if d[a[ans]] >= 1 and n % a[ans] >= 0:
		res = n // a[ans]
print(ans + 1, end=' ')
print(res)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
mins = n + 1000
index = 0
for i in range(k):
	if n % l[i] <= mins:
		mins = n % l[i]
		index = i + 1
print(index, n // l[index - 1])


(n, k) = map(int, input().split(' '))
arr = list(map(int, input().split(' ')))
arr = sorted(enumerate(arr), key=lambda a: n % a[1])
ansIndex = arr[0][0] + 1
ans = arr[0][1]
print(ansIndex, n // ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in a:
	b.append(n % i)
print(b.index(min(b)) + 1, n // a[b.index(min(b))])


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
best = -1
sel = -1
for i in range(k):
	cur = n - n % a[i]
	if best < cur:
		best = cur
		sel = i
print('%d %d' % (sel + 1, n // a[sel]))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
minn = n % arr[0]
index = 0
for i in range(1, k):
	if n % arr[i] < minn:
		minn = n % arr[i]
		index = i
print(index + 1, n // arr[index])


(k, n) = map(int, input().split())
l = list(map(int, input().split()))
r = 0
m = 0
for i in range(n):
	d = k // l[i]
	s = d * l[i]
	if s > m:
		m = s
		r = i
print(r + 1, k // l[r])


(a, b) = map(int, input().strip().split())
t = list(map(int, input().strip().split()))
c = []
for i in range(b):
	c.append(a % t[i])
x = min(c)
print(c.index(x) + 1, a // t[c.index(x)])


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
if n == 0:
	print(a.index(min(a)) + 1, 0)
else:
	for i in a:
		b.append(n % i)
	a1 = b.index(min(b))
	print(a1 + 1, n // a[a1])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
d = {}
for i in range(1, k + 1):
	d.update({i: (n // l[i - 1], n % l[i - 1])})
(a, b, c) = (1, d[1][0], d[1][1])
for i in range(2, k + 1):
	if d[i][1] < c:
		(a, b, c) = (i, d[i][0], d[i][1])
print(a, b)


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
l = []
for i in range(0, len(a)):
	e = n % a[i]
	l.append(e)
print(l.index(min(l)) + 1, n // a[l.index(min(l))])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
M = float('inf')
for i in range(k):
	if n % a[i] < M:
		M = n % a[i]
		Type = i
		con = n // a[i]
print(Type + 1, con)


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
m = 0
z = 0
c = 0
if n == 0:
	print('1 0')
else:
	for i in range(k):
		temp = n // l[i]
		if temp * l[i] > m:
			m = temp * l[i]
			c = l[i]
			z = i + 1
			num = temp
	if m == 0:
		print('1 0')
	else:
		print(z, num)


nk = list(map(int, input().split()))
arr = list(map(int, input().split()))
dif = nk[0]
for i in range(len(arr)):
	dif = min(dif, nk[0] % arr[i])
	if dif == nk[0] % arr[i]:
		boxtype = i + 1
		numofboxes = nk[0] // arr[i]
print(boxtype, numofboxes)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 10 ** 19
ind = -1
for i in range(k):
	if l[i] <= n:
		if n % l[i] < c:
			c = n % l[i]
			ind = i + 1
if ind == -1:
	print(1, 0)
else:
	print(ind, n // l[ind - 1])


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(m):
	x = n // a[i]
	b.append(x * a[i])
index = b.index(max(b))
print(index + 1, max(b) // a[index])


(n, k) = [int(x) for x in input().split()]
arr = list(map(int, input().split()))
z = [n % x for x in arr]
mini = min(z)
mini_ind = z.index(mini)
print(mini_ind + 1, n // arr[mini_ind])


import math
arr_1 = list(map(int, input().split()))
arr = list(map(int, input().split()))
N = arr_1[0]
K = arr_1[1]
temp = math.inf
ind = 1
ans = 0
for i in range(len(arr)):
	if arr[i] > N:
		pass
	elif N % arr[i] == 0:
		ans = int((N - N % arr[i]) / arr[i])
		ind = i + 1
		break
	elif N % arr[i] < temp:
		temp = N % arr[i]
		ans = int((N - N % arr[i]) / arr[i])
		ind = i + 1
print(str(ind) + ' ' + str(ans))


x = input()
y = input()
x = x.split()
n = int(x[0])
k = int(x[1])
y = y.split()
prv = 10 ** 19
rem = 0
for i in range(k):
	rem = n % int(y[i])
	if rem < prv:
		prv = rem
		indx = i
val = (n - prv) / int(y[indx])
if n == 0:
	indx = 0
	val = 0
print(indx + 1, int(val))


(k, n) = (int(i) for i in input().strip().split())
a = [int(i) for i in input().strip().split()]
d = 1e+19
s = 0
for i in range(n):
	if a[i] != 0 and k - a[i] * (k // a[i]) < d:
		s = a[i]
		d = k - a[i] * (k // a[i])
print(a.index(s) + 1, k // s)


(n, k) = map(int, input().split())
boxes = [int(i) for i in input().split()]
left = []
for i in range(k):
	left.append(n % boxes[i])
box = left.index(min(left))
print(box + 1, n // boxes[box])


x = input().split()
n = int(x[0])
k = int(x[1])
x.clear()
x = input().split()
few = int(10 ** 18)
ind = 0
a = 0
for i in range(k):
	p = n % int(x[i])
	if not p:
		ind = i + 1
		a = int(n // int(x[i]))
		break
	elif p < few:
		few = p
		ind = i + 1
		a = int(n // int(x[i]))
print('{0} {1}'.format(ind, a))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
min = 0
for i in range(1, k):
	if n % a[i] < n % a[min]:
		min = i
print(min + 1, n // a[min])


(m, k) = map(int, input().split())
l = list(map(int, input().split()))
(n, t, h) = (0, 0, 0)
for q in range(k):
	j = m % l[q]
	if n == 0:
		n = m // l[q]
		t = q + 1
		h = j
	elif j < h:
		h = j
		n = m // l[q]
		t = q + 1
print(t, n)


(N, K) = map(int, input().split())
l = list(map(int, input().split()))
min1 = float('inf')
for i in range(K):
	r = N % l[i]
	min1 = min(min1, r)
	if min1 == r:
		index = i + 1
print(index, N // l[index - 1])


f = input().split()
n = int(f[0])
k = int(f[1])
z = input().split()
lst = []
for i in z:
	x = int(i)
	lst.append(x)
mini = n + 1
for i in range(len(lst)):
	x = n % lst[i]
	if x < mini:
		mini = x
		gat = i
num = n // lst[gat]
print(gat + 1, num)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
temp2 = 1000000000000000000
for i in range(k):
	temp = n % a[i]
	if temp < temp2:
		b = [i + 1, n // a[i]]
		temp2 = temp
print(b[0], b[1])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
x = 0
ma = 0
ans = 0
ans1 = 0
while x < k:
	if l[x] * (n // l[x]) > ma:
		ma = l[x] * (n // l[x])
		ans1 = n // l[x]
		ans = x
	x += 1
print(ans + 1, ans1)


import random, math, os, sys, re
(n, k) = map(int, input().split())
rem = n
a = list(map(int, input().split()))
for (c, i) in enumerate(a):
	if n // i > 0 and n % i < rem:
		rem = n % i
		kind = c
if rem != n:
	print(kind + 1, n // a[kind])
else:
	print(1, 0)


import sys
(n, k) = map(int, sys.stdin.readline().split())
a = list(map(int, input().split()))
maxa = 100000000000000000000000
for i in range(0, len(a)):
	if n % a[i] < maxa:
		maxa = n % a[i]
		ans = n // a[i]
		ind = i + 1
print(ind, ans)


(n, k) = map(int, input().split())
ls = list(map(int, input().split()))
mods = [n % i for i in ls]
print(mods.index(min(mods)) + 1, n // ls[mods.index(min(mods))])


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
m = 0
j = 0
for i in range(k):
	c = n - n % a[i]
	if c > m:
		m = c
		j = i
print(j + 1, n // a[j])


(n, k) = input().split()
a = [int(i) for i in input().split()]
maxs = 0
p = 0
pos = 0
for i in range(int(k)):
	p = int(n) // a[i]
	if maxs < a[i] * p:
		maxs = a[i] * p
		pos = i
print(pos + 1, end=' ')
print(maxs // a[pos])


import sys
import math
from collections import OrderedDict

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def listinput():
	return list(map(int, input().split()))
(n, k) = minput()
l = listinput()
l1 = []
for i in range(k):
	l1.append(n % l[i])
m1 = min(l1)
m2 = l[l1.index(m1)]
print(l1.index(m1) + 1, n // m2)


import sys
import math
(N, K) = map(int, input().split())
arr = list(map(int, input().split()))
Min = int(sys.maxsize * sys.maxsize)
ans = int(0)
ans1 = int(0)
for i in range(0, K):
	x = int(N % arr[i])
	if x < Min:
		ans = i + 1
		Min = x
		ans1 = int(math.floor(N / arr[i]))
		if ans1 * arr[i] > N:
			ans1 = ans1 - 1
print(ans, ans1)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
maxn = n
ansi = 0
for i in range(k):
	if n % a[i] < maxn:
		ansi = i
		maxn = n % a[i]
print(ansi + 1, n // a[ansi])


(n, m) = map(int, input().split())
a = str(input()).split()
for i in range(len(a)):
	a[i] = int(a[i])
s = n
mi = n
iii = 1
nn = 0
for i in range(m):
	aa = n % a[i]
	if mi > aa:
		mi = aa
		iii = i + 1
		nn = n // a[i]
print(iii, int(nn))


import sys

def read_int():
	return int(input())

def read_ints():
	return [int(x) for x in input().split()]
(n, k) = read_ints()
a = read_ints()
(res_i, res_q) = (0, 0)
for (i, b) in enumerate(a):
	if n - n % b > a[res_i] * res_q:
		(res_i, res_q) = (i, n // b)
print(res_i + 1, res_q)


I = lambda : map(int, input().split())
(n, k) = I()
a = (*I(),)
r = min(range(k), key=lambda x: n % a[x])
print(r + 1, n // a[r])


(n, k) = list(map(int, input().split()))
r = list(map(int, input().split()))
j = 10000000000000000000
bl = 0
ans = 0
for i in r:
	if n % i < j:
		j = n % i
		bl = r.index(i)
		ans = n // i
print(bl + 1, int(ans))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
maxi = 0
minimum = n
for i in range(len(a)):
	if n % a[i] < minimum:
		minimum = n % a[i]
		maxi = i
print(maxi + 1, n // a[maxi])


(n, k) = map(int, input().split())
mx = 0
idx = 1
take = 0
for (i, x) in enumerate(input().split()):
	x = int(x)
	i += 1
	can = n // x * x
	if can > mx:
		mx = can
		idx = i
		take = n // x
print(idx, take)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
temp = 0
rem = float('inf')
for i in range(k):
	if n % a[i] < rem:
		rem = n % a[i]
		temp = i
	if rem == 0:
		temp = i
		break
print(temp + 1, n // a[temp])


(n, k) = input().split()
n = int(n)
k = int(k)
a = input().split()
a = list(map(int, a))
typ = 1
num = 0
maxi = 0
hms = 0
for i in range(k):
	hms = n - n % a[i]
	if hms > maxi:
		typ = i + 1
		num = hms / a[i]
		maxi = hms
print(typ, int(num))


n = input().split()
k = int(n[1])
n = int(n[0])
l = input().split()
maxbox = 0
minmod = n + 1
for i in range(k):
	if n % int(l[i]) < minmod:
		minmod = n % int(l[i])
		maxbox = i
print(maxbox + 1, n // int(l[maxbox]))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = [0] + l
x = [0]
ans = 0
mi = 10 ** 18 + 9
for i in range(1, k + 1):
	if n % l[i] < mi:
		ans = i
		mi = n % l[i]
print(ans, n // l[ans])


import sys
from itertools import permutations
m = 1000000007
(n, k) = map(int, sys.stdin.readline().split(' '))
a = list(map(int, input().strip().split(' ')))
t = 1
num = 0
rem = 10000000000000000000000000000000000
for i in range(k):
	if n % a[i] < rem:
		rem = n % a[i]
		t = i
		num = n // a[i]
print(t + 1, num)


(n, k) = map(int, input().split())
mindif = 1000000000000000000
numbers = [int(i) for i in input().split()]
for (i, number) in enumerate(numbers):
	if n % number < mindif:
		mindif = n % number
		sol = n // number
		sol2 = i + 1
print(sol2, sol)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
fix = -1
maxi = -1
box = -1
for i in range(k):
	to = n // a[i]
	tot = to * a[i]
	if tot > fix:
		fix = tot
		maxi = to
		box = i + 1
print(box, maxi)


(n, k) = map(int, input().split())
m = 10 ** 19
ki = 0
kq = 0
a = [int(i) for i in input().split()]
for i in range(len(a)):
	if n % a[i] < m:
		m = n % a[i]
		ki = i + 1
		kq = n // a[i]
print(ki, kq)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k):
	a[i] = [a[i], i + 1]
a.sort(key=lambda val: n % val[0])
print(a[0][1], n // a[0][0])


R = lambda : map(int, input().split())
(n, k) = R()
b = list(R())

def solve(n, k, b):
	m = [n % b[i] for i in range(k)]
	from operator import itemgetter
	i = min(enumerate(m), key=itemgetter(1))[0]
	return (i, n // b[i])
t = solve(n, k, b)
print(t[0] + 1, t[1])


(a, b) = input().split()
s = input()
a = int(a)
b = int(b)
v = []
v = s.split()
m = a % int(v[0])
mind = 1
if a != 0:
	for i in range(b):
		v[i] = int(v[i])
		if m > a % v[i]:
			m = a % v[i]
			mind = i + 1
	print(mind, a // v[mind - 1])
else:
	print(1, 0)


n_k = list(map(int, input().split()))
k = list(map(int, input().split()))
min_rem = n_k[0] % k[0]
min_ind = 1
for i in range(2, n_k[1] + 1):
	if n_k[0] % k[i - 1] < min_rem:
		min_rem = n_k[0] % k[i - 1]
		min_ind = i
print(min_ind, n_k[0] // k[min_ind - 1])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = min(((i, n % box) for (i, box) in enumerate(a)), key=lambda x: x[1])
print(m[0] + 1, n // a[m[0]])


(N, k) = map(int, input().split())
arr = list(map(int, input().split()))
brr = [N % i for i in arr]
print(brr.index(min(brr)) + 1, N // arr[brr.index(min(brr))])


def hamsters(n, k, capacities):
	INF = n
	best = (None, INF)
	i = 0
	while i < k:
		t = n % capacities[i]
		if t < best[1]:
			best = (i, t)
		i += 1
	if best[1] == INF:
		return (1, 0)
	return (best[0] + 1, n // capacities[best[0]])
(n, k) = list(map(int, input().split()))
best = hamsters(n, k, list(map(int, input().split())))
print(f'{best[0]} {best[1]}')


(n, k) = map(int, input().split())
ar = [int(p) for p in input().split()]
maxim = -1
pos = 0
for i in range(k):
	t = n - n % ar[i]
	if t > maxim:
		maxim = t
		pos = i + 1
if not pos:
	print(0, 0)
else:
	print(pos, n // ar[pos - 1])


(n, k) = map(int, input().split())
boxes = list(map(int, input().split()))
j = 0
for i in range(1, k):
	if n % boxes[i] < n % boxes[j]:
		j = i
print(j + 1, n // boxes[j])


(N, K) = [int(i) for i in input().split()]
a = list(map(int, input().split()))
r = [0, 0]
d = 0
min_res = 1e+21
res = 0
flag = False
for (index, i) in enumerate(a):
	if i == 0:
		continue
	if N >= i:
		d = N // i
		res = N % i
		if res < min_res:
			min_res = res
			r = [index + 1, d]
		flag = True
if flag:
	print(r[0], r[1])
else:
	print(1, 0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
maxi = 10000000000000000000
for i in range(len(a)):
	if n % a[i] < maxi:
		maxi = n % a[i]
		z = n // a[i]
		s = i
print(str(s + 1) + ' ' + str(z))


inp1 = [int(i) for i in input().split()]
n = inp1[0]
k = inp1[1]
lst = [int(i) for i in input().split()]
rem = [n % i for i in lst]
index = rem.index(min(rem))
print(index + 1, n // lst[index])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 1000011111111111111111111111111111111111111111111111
for i in range(len(l)):
	ans = min(ans, n % l[i])
	if ans == n % l[i]:
		(c, d) = (i + 1, n // l[i])
print(c, d)


t = list(map(int, input().split()))[0]
box = list(map(int, input().split()))
div = []
for i in box:
	div.append(t % i)
m = div.index(min(div))
print(m + 1, t // box[m])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(lambda x: n % x, a))
c = list(map(lambda x: n // x, a))
i = b.index(min(b))
print(i + 1, c[i])


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
j = k * [0]
for i in range(k):
	j[i] = n % a[i]
print(j.index(min(j)) + 1, n // a[j.index(min(j))])


arr = input().split()
n = int(arr[0])
k = int(arr[1])
arr1 = list(map(int, input().split()))
mx = (0, 10 ** 18)
for i in range(k):
	if n % arr1[i] < mx[1]:
		mx = (i, n % arr1[i])
print(mx[0] + 1, n // arr1[mx[0]])


(w, b) = map(int, input().split())
c = []
s = input().split()
for a in s:
	a = int(a)
	c.append(a)
max = 1000000000000000000
no = []
for i in range(len(c)):
	rem = w // c[i]
	q = rem * c[i]
	substract = w - q
	if substract < max:
		max = substract
		no = [i, rem]
print(no[0] + 1, no[1])


n = list(map(int, input().split()))
k = n[1]
n = n[0]
a = list(map(int, input().split()))
if n == 0:
	print(1, 0)
else:
	s = -1
	h = n % a[0]
	for i in range(len(a)):
		if n % a[i] <= h:
			t = n // a[i]
			s = i + 1
			h = n % a[i]
	print(s, t)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
ma = 10 ** 18 + 1
it = 0
for i in range(m):
	if n % a[i] < ma:
		it = i + 1
		ma = n % a[i]
print(it, n // a[it - 1])


a = input()
a = list((int(x) for x in a.split(' ')))
n = a[0]
k = a[1]
a = input()
a = list((int(x) for x in a.split(' ')))
res = num = 0
for i in range(len(a)):
	if n // a[i] * a[i] > res * a[num]:
		res = n // a[i]
		num = i
print(num + 1, res)


from cmath import inf
(N, K) = map(int, input().split())
a = list(map(int, input().split()))
(m, type, num) = (inf, -1, -1)
for (i, el) in enumerate(a, 1):
	temp = N % el
	if temp < m:
		m = temp
		type = i
		num = N // el
print(type, num)


(n, k) = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
ians = int(1e+19)
kans = int(1e+19)
for i in range(k):
	t = q[i]
	tk = n % t
	kans = min(kans, tk)
	if kans == tk:
		ians = i
print(ians + 1, n // q[ians])


GI = lambda : int(input())
GIS = lambda : map(int, input().split())

def main():
	(N, K) = GIS()
	capacities = GIS()
	best_cap = None
	amount = None
	least_remainder = float('inf')
	for (i, cap) in enumerate(capacities, 1):
		(am, rem) = divmod(N, cap)
		if rem < least_remainder:
			least_remainder = rem
			amount = am
			best_cap = i
	print(best_cap, amount)
main()


(n, k) = input().split()
n = int(n)
k = int(k)
a = []
s = input()
a = s.split()
q = n // int(a[0])
w = 1
for i in range(1, k):
	if n // int(a[i]) * int(a[i]) > q * int(a[w - 1]):
		q = n // int(a[i])
		w = i + 1
print(str(w) + ' ' + str(q))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = []
for (i, v) in enumerate(a):
	l.append([n % v, i])
l.sort()
print(l[0][1] + 1, n // a[l[0][1]])


def input_ints():
	return list(map(int, input().split()))

def main():
	(x, n) = input_ints()
	a = input_ints()
	ma = -1
	ans = None
	for i in range(n):
		tmp = x // a[i] * a[i]
		if tmp > ma:
			ma = tmp
			ans = (i + 1, x // a[i])
	print(ans[0], ans[1])
main()


n = int(input().split()[0])
k = [int(x) for x in input().split()]
currmax = -1
curri = -1
currx = -1
for (i, x) in enumerate(k):
	if x > n:
		continue
	t = n // x
	a = t * x
	if a > currmax:
		currmax = a
		curri = i + 1
		currx = t
if currmax == -1:
	(curri, currx) = (1, 0)
print(' '.join([str(curri), str(currx)]))


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = 1
if debug:
	test_count = inp()
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	(n, k) = invr()
	a = inlt()
	min_r = n + 1
	min_index = -1
	min_k = -1
	for i in range(k):
		d = a[i]
		r = n % d
		if r < min_r:
			min_r = r
			min_index = i + 1
			min_k = d
		if r == 0:
			break
	print(min_index, n // min_k)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
t = 1
r = n % a[0]
for i in range(1, k):
	if n % a[i] < r:
		r = n % a[i]
		t = i + 1
print(t, end=' ')
print(n // a[t - 1])


x = input()
x = x.split()
ham = int(x[0])
y = input()
y = y.split()
current = 999999999999999999999999999999999999999999999999999999999
temp = current
ind = 0
for i in range(int(x[1])):
	if ham == 0:
		ind = 1
		no = 0
		break
	if ham > int(y[i]):
		rem = ham % int(y[i])
		if rem < current:
			current = rem
			ind = i + 1
	elif ham == int(y[i]):
		ind = i + 1
		break
if ham == 0 or ind == 0:
	ind = 1
	no = 0
elif temp != current:
	no = (ham - current) / int(y[ind - 1])
else:
	no = 1
print(ind, int(no))


from typing import List
(n, k) = map(int, input().split())
arr: List = list(map(int, input().split()))
mi = 1e+20
an = 0
if n == 0:
	print('1 0')
else:
	for i in range(k):
		if n % arr[i] < mi:
			mi = n % arr[i]
			an = i
	print(an + 1, n // arr[an])


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
array = []
for i in range(k):
	array.append([i, a[i], n % a[i]])
array.sort(key=lambda i: i[2])
print(array[0][0] + 1, n // array[0][1])


import sys, math
(n, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
rem = [0] * k
for i in range(k):
	rem[i] = n % a[i]
ind = rem.index(min(rem))
x = n // a[ind]
print(ind + 1, x)


(N, K) = map(int, input().split())
l = list(map(int, input().split()))
(m, p) = (N, 0)
for i in range(K):
	if N % l[i] < m:
		m = N % l[i]
		p = i
print(p + 1, N // l[p])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
index = 0
num = 0
min_hamsters = n
for (x, i) in enumerate(a):
	if n % i < min_hamsters:
		index = x
		num = n // i
		min_hamsters = n % i
		if min_hamsters == 0:
			break
print(index + 1, num)


x = input()
x = x.split(' ')
h = int(x[0])
n = int(x[1])
arr = []
arr = input()
arr = arr.split(' ')
best = (1, h % int(arr[0]))
for i in range(n):
	val = int(arr[i])
	x = h % val
	if x < best[1]:
		best = (i + 1, x)
print(best[0], int(h // int(arr[best[0] - 1])))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
meh = [n % arr[i] for i in range(k)]
ind = -1
mx = 10 ** 18
for i in range(k):
	if meh[i] < mx:
		mx = meh[i]
		ind = i
print(ind + 1, n // arr[ind])


from decimal import *
import math

class Hamster_Farm:

	def main(self):
		(n, k) = map(int, input().strip().split(' '))
		a = [int(x) for x in input().split()]
		temp = 999999999999999999999999999
		num = 0
		for i in range(k):
			count = 0
			if n % a[i] == 0:
				print(str(i + 1) + ' ' + str(int(n / a[i])))
				return
			count = int(n % a[i])
			if temp > count:
				temp = count
				getcontext().prec = 28
				num = int(Decimal(n) / Decimal(a[i]))
				temp1 = i + 1
		print(str(temp1) + ' ' + str(num))
hf = Hamster_Farm()
hf.main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = 10 ** 20
for i in range(k):
	if m > n % a[i]:
		m = n % a[i]
		im = i
print(im + 1, n // a[im])


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = []
k = -2
for i in range(m):
	b.append(n % a[i])
k = min(b)
k = b.index(k)
print(k + 1, n // a[k])


(n, k) = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
l1 = []
for i in range(k):
	l1.append(n % l[i])
m = min(l1)
idx = l1.index(m)
print(idx + 1, end=' ')
print(n // l[idx])


(k, n) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
ans = 1
for i in range(n):
	if k // a[i] * a[i] > count:
		count = k // a[i] * a[i]
		ans = i + 1
print(ans, count // a[ans - 1])


import math
(n, k) = map(int, input().split(' '))
list1 = list(map(int, input().split(' ')))
ind = 0
sum1 = 0
mini = 10 ** 20
ct = 0
for j in list1:
	q = n % j
	if q < mini:
		sum1 = n // j
		ind = ct
		mini = q
	ct += 1
print(ind + 1, sum1)


(n, k) = map(int, input().split())
(mini, counts, type, i) = (1000000000000000009, 0, 0, 1)
for box in list(map(int, input().split())):
	if n % box < mini:
		ans = n // box
		mini = n % box
		type = i
	i += 1
print(type, ans)


l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l = []
for i in range(len(l2)):
	t = l1[0] % l2[i]
	l.append(t)
a = l[0]
t = 0
for i in range(1, len(l)):
	if l[i] < a:
		a = l[i]
		t = i
w = []
w.append(t + 1)
w.append(l1[0] // l2[t])
for i in w:
	print(i, end=' ')


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def int1():
	return int(input())
import string
import math
from itertools import combinations

def main():
	(n, k) = get_array()
	a = get_array()
	l = []
	i = 0
	while i < k:
		l.append(n % a[i])
		i = i + 1
	r = l.index(min(l))
	print(r + 1, n // a[r])
main()


import sys
import math
import bisect

def solve(A, m):
	n = len(A)
	max_val = -1
	sol = -1
	for i in range(n):
		val = m - m % A[i]
		if max_val < val:
			max_val = val
			sol = i
	return (sol, max_val // A[sol])

def main():
	(m, n) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = solve(A, m)
	print('%d %d' % (ans[0] + 1, ans[1]))
main()


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
m = [0] * k
for i in range(k):
	m[i] = n % a[i]
i = m.index(min(m)) + 1
print(i, n // a[i - 1])


def read_nums():
	return list(map(int, input().strip().split()))

def read_int():
	return read_nums()[0]
(N, K) = read_nums()
boxes = read_nums()
best = (-1, N, N)
for (i, val) in enumerate(boxes):
	if N % val <= best[1]:
		best = (i, N % val, N // val)
print(best[0] + 1, best[2])


(N, K) = map(int, input().split())
r = list(map(int, input().split()))
Min = 10000000000000000000
for i in range(K):
	x = N % r[i]
	if x < Min:
		Min = x
		a = [i + 1, N // r[i]]
print(a[0], a[1])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def main():
	(n, k) = LI()
	a = LI()
	r = 0
	ri = 0
	rc = 0
	for i in range(k):
		c = a[i]
		t = n // c * c
		if r < t:
			r = t
			ri = i
			rc = n // c
	return '{} {}'.format(ri + 1, rc)
print(main())


(hamsters, totalBoxes) = list(map(int, input().split(' ')))
boxes = list(map(int, input().split(' ')))
bestBox = -1
hamstersLeft = 10 ** 20
for i in range(totalBoxes):
	remainder = hamsters % boxes[i]
	if remainder < hamstersLeft:
		bestBox = i + 1
		hamstersLeft = remainder
print(str(bestBox) + ' ' + str(hamsters // boxes[bestBox - 1]))


def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	rem = 10 ** 19
	(id, num) = (-1, -1)
	for i in range(k):
		t = n // a[i]
		tr = n - a[i] * t
		if rem > tr:
			rem = tr
			id = i + 1
			num = t
	print(id, num)
main()


(n, k) = [int(x) for x in input().split()]
s = input()
v = [int(x) for x in s.split()]
d = [n - n // x * x for x in v]
print(d.index(min(d)) + 1, n // v[d.index(min(d))])


import sys
(n, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
maximum = [-1, -1]
for i in range(k):
	ham = n - n % a[i]
	if ham > maximum[0]:
		maximum[0] = ham
		maximum[1] = i
if maximum[0] != 0:
	print(str(maximum[1] + 1) + ' ' + str(int(n // a[maximum[1]])))
else:
	print(str(maximum[1] + 1) + ' ' + str(0))


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
p = 0
for i in range(k):
	t = n // a[i] * a[i]
	if t > p:
		p = t
		x = i + 1
		y = n // a[i]
if p == 0:
	print(1, 0)
else:
	print(x, y)


(hams, boxes) = map(int, input().split())
index = 0
types = list(map(int, input().split()))
for i in range(len(types)):
	if hams % types[i] < hams % types[index]:
		index = i
print(index + 1, hams // types[index])


import sys

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

def ssinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def nninp():
	return map(int, sys.stdin.readline().strip().split())

def llinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
(n, k) = nninp()
a = llinp()
ans = 0
rem = float('inf')
for i in range(k):
	rem1 = n % a[i]
	if rem1 < rem:
		rem = rem1
		ans = i + 1
print(ans, n // a[ans - 1])


(n, k) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
max_i = 0
for i in range(k):
	if n % a[i] < n % a[max_i]:
		max_i = i
print(max_i + 1, n // a[max_i], sep=' ')


rd = lambda : map(int, input().split())
(n, k) = rd()
a = rd()
i = 0
p = 0
q = 0
m = 4557430888798830399
for x in a:
	i += 1
	t = n % x
	if t < m:
		m = t
		p = i
		q = x
print(p, n // q)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
dic = {n % s[i]: i + 1 for i in range(k)}
l = [n % s[i] for i in range(k)]
l.sort()
print(dic[l[0]], n // s[dic[l[0]] - 1])


n = [int(inp) for inp in input().split()]
arr = [int(inp) for inp in input().split()]
maxn = -1
chosent = -1
chosenb = -1
it = 1
for f in arr:
	div = int(n[0]) // int(f)
	num = div * f
	if num > maxn:
		maxn = num
		chosenb = it
		chosent = div
	it += 1
print(chosenb, chosent)


(n, k) = [int(y) for y in input().split()]
l = [int(y) for y in input().split()]
mini = 1000000000000000000
ind = -1
val = 0
for i in range(k):
	x = n % l[i]
	if mini > x:
		mini = x
		ind = i + 1
		val = n // l[i]
print(ind, val)


(n, k) = input().split()
n = int(n)
k = int(k)
Ar = [int(x) for x in input().split()]
M = n % Ar[0]
q = 0
for i in range(k):
	r = n % Ar[i]
	if M > r:
		M = r
		q = i
print(q + 1, end=' ')
print(n // Ar[q])


(n, k) = map(int, input().split())
b = list(map(int, input().split()))
h = n
for i in range(k):
	if n % b[i] <= h:
		h = n % b[i]
		boxes = i
print(boxes + 1, n // b[boxes])


n = input().split()
(n, k) = (int(n[0]), int(n[1]))
boxes = input().split()
boxes = list(map(int, boxes))
array = []
for i in range(k):
	array.append(n % boxes[i])
minimum = 0
for j in range(k):
	if array[j] <= array[minimum]:
		minimum = j
print(str(minimum + 1) + ' ' + str(n // boxes[minimum]))


(a, b) = map(int, input().split())
s = s1 = s2 = 0
for (i, j) in zip(range(1, b + 1), map(int, input().split())):
	if s <= j * (a // j):
		s = j * (a // j)
		s1 = i
		s2 = a // j
print(s1, s2)


(n, k) = input().split()
(n, k) = [int(n), int(k)]
a = [int(i) for i in input().split()]
c = []
count = 0
for i in range(0, k):
	c.append(n % a[i])
m = min(c)
ind = c.index(min(c))
print(ind + 1, n // a[ind])


from decimal import *
import math
c = Context(rounding=ROUND_DOWN)
l = list(map(lambda x: int(x), input().split(' ')))
(n, k) = (l[0], l[1])
boxes = list(map(lambda x: int(x), input().split(' ')))
m = 0
box = 0
cap = 0
for (i, b) in enumerate(boxes):
	v = math.floor(c.create_decimal(n) / c.create_decimal(b))
	if v * b > m * cap:
		m = v
		box = i
		cap = b
print(str(box + 1) + ' ' + str(m))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	(n, k) = read()
	a = get_list()
	boxes = []
	for (i, x) in enumerate(a):
		boxes.append([n % x, i + 1])
	boxes.sort()
	print(boxes[0][1], n // a[boxes[0][1] - 1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(1):
	solve()


from math import inf
(n, box_types) = map(int, input().strip().split())
cs = list(map(int, input().strip().split()))
mi = 0
mr = inf
for (i, c) in enumerate(cs):
	r = n % c
	if r < mr:
		mi = i
		mr = r
print(mi + 1, n // cs[mi])


getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
(n, k) = getInputIntList()
arr = getInputIntList()
new = []
for i in arr:
	new.append(n % i)
index = new.index(min(new)) + 1
print(index, int(n // arr[index - 1]))


(n, k) = map(int, input().split())
types = list(map(int, input().split()))
least = n % types[0]
tp_box = 1
for i in range(1, k):
	remainder = n % types[i]
	if remainder < least:
		least = remainder
		tp_box = i + 1
num_box = n // types[tp_box - 1]
print(tp_box, num_box)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
mod = n % l[0]
typ = 1
num = n // l[0]
for i in range(k):
	if n % l[i] < mod:
		mod = n % l[i]
		typ = i + 1
		num = n // l[i]
print(typ, num)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
r = n % a[0]
x = 1
for i in range(1, k):
	r1 = n % a[i]
	if r1 < r:
		r = r1
		x = i + 1
	else:
		continue
print('%s %s' % (x, n // a[x - 1]))


from sys import stdin
(n, k) = [int(i) for i in stdin.readline().split(' ')]
boxes = [int(i) for i in stdin.readline().split(' ')]
minRemaining = n
box = 0
for i in range(0, k):
	if n % boxes[i] <= minRemaining:
		minRemaining = n % boxes[i]
		box = i
print(str(box + 1) + ' ' + str(n // boxes[box]))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
res = 0
res_i = 0
for i in range(len(a)):
	if n // a[i] * a[i] > res:
		res = n // a[i] * a[i]
		res_i = i
print(res_i + 1, n // a[res_i])


(n, k) = map(int, input().split())
min = 10 ** 18
ans = 0
ansi = 1
al = input().split()
for i in range(1, k + 1):
	a = int(al[i - 1])
	r = n % a
	if r < min:
		min = r
		ans = n // a
		ansi = i
print('%d %d\n' % (ansi, ans))


line = input()
(N, K) = (int(line.strip().split()[0]), int(line.strip().split()[1]))
line = input()
nums = [int(item) for item in line.strip().split()]
mmax = -1
k = -1
for i in range(K):
	cap = nums[i]
	cur = N // cap * cap
	if cur > mmax:
		mmax = cur
		k = i
print(k + 1, N // nums[k])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
maxi = 0
ans = [1, 0]
for i in range(1, k + 1):
	z = l[i - 1]
	d = n // z * z
	if d > maxi:
		maxi = d
		ans = [i, n // z]
print(*ans)


(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
arr = list(map(int, input().strip().split(' ')))
(a, b) = ([], [])
for i in arr:
	if i:
		a.append(n // i)
		b.append(n // i * i)
	else:
		a.append(0)
		b.append(0)
ans = 0
index = 0
for i in range(k):
	if ans == b[i] and a[i] <= a[index]:
		ans = b[i]
		index = i
	elif ans < b[i]:
		ans = b[i]
		index = i
print(index + 1, a[index])


def hamsterFarm():
	(n, k) = map(int, input().split())
	bL = list(map(int, input().split()))
	minVal = 0
	minR = 0
	for i in range(k):
		if i == 0:
			minVal = bL[i]
			minR = n % bL[i]
		elif n % bL[i] < minR:
			minVal = bL[i]
			minR = n % bL[i]
	return str(bL.index(minVal) + 1) + ' ' + str(n // minVal)
ans = hamsterFarm()
print(ans)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
ans = 0
com = n % a[0]
for i in range(1, k):
	if n % a[i] < com:
		com = n % a[i]
		ans = i
print(ans + 1, ' ', n // a[ans])


def parser():
	while 1:
		data = list(input().split(' '))
		for number in data:
			if len(number) > 0:
				yield number
input_parser = parser()

def get_word():
	global input_parser
	return next(input_parser)

def get_number():
	data = get_word()
	try:
		return int(data)
	except ValueError:
		return float(data)
a = [0 for i in range(100010)]
N = get_number()
K = get_number()
(minn, id) = (N, 1)
for i in range(1, K + 1):
	a[i] = get_number()
	if N % a[i] < minn:
		(minn, id) = (N % a[i], i)
print(id, N // a[id])


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
num = -1
mino = int(1e+18)
for i in range(k):
	if mino > n % a[i]:
		num = i + 1
		mino = n % a[i]
print(num, n // a[num - 1])


(n, k) = map(int, input().split())
mini = 2e+18
id = -1
v = [int(i) for i in input().split()]
for i in range(k):
	if n % v[i] < mini:
		mini = n % v[i]
		id = i + 1
print(id, n // v[id - 1])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
m = n
x = 0
for (i, j) in enumerate(l):
	if n % j < m and j < n:
		m = n % j
		x = i
print(x + 1, n // l[x])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
i = 1
x = 0
h = 0
for j in range(k):
	y = n // a[j]
	if h < y * a[j]:
		h = y * a[j]
		x = y
		i = j + 1
print('%d %d' % (i, x))


(n, k) = map(int, input().split())
x = [int(q) for q in input().split()]
p = []
for i in range(len(x)):
	p.append(n % x[i])
if n == 0:
	print(1, 0)
else:
	d = min(p)
	ans = []
	ans.append(p.index(d) + 1)
	ans.append(n // x[p.index(d)])
	print(*ans)


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def power_set(L):
	cardinality = len(L)
	n = 2 ** cardinality
	powerset = []
	for i in range(n):
		a = bin(i)[2:]
		subset = []
		for j in range(len(a)):
			if a[-j - 1] == '1':
				subset.append(L[j])
		powerset.append(subset)
	powerset_orderred = []
	for k in range(cardinality + 1):
		for w in powerset:
			if len(w) == k:
				powerset_orderred.append(w)
	return powerset_orderred

def fastPlrintNextLines(a):
	print('\n'.join(map(str, a)))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = 1
for _ in range(t):
	(n, k) = li()
	a = li()
	mi = 100000000
	mv = 1000000000000000000000000000000000
	for i in range(k):
		if n % a[i] < mv:
			mv = n % a[i]
			mi = i
	print(mi + 1, n // a[mi])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
ans = 0
ans2 = 0
for i in range(k):
	x = n // l[i]
	y = x * l[i]
	if y > c:
		c = y
		ans = i
		ans2 = x
	if y == c:
		c = y
		if ans2 < x:
			ans2 = x
			ans = i
s = ''
s = s + str(ans + 1) + ' ' + str(ans2)
print(s)


(n, m) = map(int, input().split())
x = list(map(int, input().split()))
if n == 0:
	print(1, 0)
else:
	k = 0
	min = 10 ** 18
	j = -10 ** 18
	for i in range(len(x)):
		if n % x[i] <= min and n >= x[i]:
			min = n % x[i]
			j = i
	if j != -10 ** 18:
		print(j + 1, n // x[j])
	else:
		print(1, 0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = n
for i in range(k):
	if n % a[i] <= m:
		m = n % a[i]
		ans = i
print(ans + 1, n // a[ans])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
t = 0
m = 0
r = 1000000000000000000
for i in range(k):
	p = n % a[i]
	if r > p:
		r = p
		t = i + 1
		m = n // a[i]
print(t, m)


def Hamster(amounts, boxsize):
	a = 10000000000000000000
	result = [0, 0]
	for i in range(0, len(boxsize)):
		if amounts[0] % boxsize[i] < a:
			a = amounts[0] % boxsize[i]
			result[0] = i + 1
			result[1] = int(amounts[0] // boxsize[i])
	return str(result[0]) + ' ' + str(result[1])

def hello():
	amounts = list(map(int, input().strip().split(' ')))
	boxsize = list(map(int, input().strip().split(' ')))
	result = Hamster(amounts, boxsize)
	print(result)
hello()


(N, K) = map(int, input().split(' '))
L = list(map(int, input().split(' ')))
C = []
D = []
for i in range(0, K):
	R = N % L[i]
	R1 = N // L[i]
	D.append(R1)
	C.append(R)
RR = C.index(min(C))
U = D[RR]
RR = RR + 1
print(RR, U)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
ma = 0
for x in range(len(l)):
	if n % l[x] < n % l[ma]:
		ma = x
print(ma + 1, n // l[ma])


from sys import stdin as si
from collections import Counter as c

class Solution:

	def bazinga(self, n, m):
		if n == 0:
			return '1 0'
		(l, b) = (n, 0)
		ans = [1, b]
		for i in range(len(m)):
			bb = n // m[i]
			ll = n % m[i]
			if ll < l:
				ans[0] = i + 1
				ans[1] = bb
				(l, b) = (ll, bb)
			elif ll == l:
				if ans[1] < bb:
					ans[0] = i + 1
					ans[1] = bb
					(l, b) = (ll, bb)
		return ' '.join(map(str, ans))
(n, k) = map(int, si.readline().strip().split())
m = list(map(int, si.readline().strip().split()))
S = Solution()
print(S.bazinga(n, m))


import math
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
min_val = int(1 + math.pow(10, 18))
for i in range(k):
	if n % a[i] < min_val:
		min_val = n % a[i]
		ind_val = i
print(ind_val + 1, n // a[ind_val])


[n, k] = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in a:
	l.append(i * (n // i))
print(str(l.index(max(l)) + 1) + ' ' + str(n // int(a[l.index(max(l))])))


s = input()
s = s.split()
s[0] = int(s[0])
s[1] = int(s[1])
d = input()
d = d.split()
for i in range(s[1]):
	d[i] = int(d[i])
r1 = []
for i in d:
	r1 += [s[0] % i]
x = min(r1)
a = r1.index(min(r1))
print(a + 1, s[0] // d[a], sep=' ')


(N, K) = map(int, input().split())
mas = list(map(int, input().split()))
k = 10000000000000000000000000000000000000000
ch = None
for el in mas:
	q = N % el
	if q < k:
		k = q
		ch = el
		if k == 0:
			print(mas.index(el) + 1, N // el)
			exit(0)
print(mas.index(ch) + 1, N // ch)


(n, k) = [int(i) for i in input().split()]
s = [int(i) for i in input().split()]
u = 100000000000000000000000000000000000000000000
m = 0
for i in range(k):
	if n % s[i] < u:
		u = n % s[i]
		m = i
print(m + 1, n // s[m])


(n, k) = map(int, input().split())
box = list(map(int, input().strip().split()))
t = [n % i for i in box]
print(t.index(min(t)) + 1, n // box[t.index(min(t))])


a = [int(x) for x in input().split()]
(n, k) = a
m = [int(y) for y in input().split()]
o = []
for i in range(len(m)):
	o.append(n % m[i])
l = []
for i in range(len(m)):
	l.append(n // m[i])
print(o.index(min(o)) + 1, l[o.index(min(o))])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in a:
	t = n // i
	m = t * i
	b.append([t, m, i])
b.sort(key=lambda x: x[1])
print(a.index(b[-1][2]) + 1, b[-1][0])


enter = input()
entree = enter.split(' ')
(nbHamster, k) = (int(entree[0]), int(entree[1]))
entrance = input()
boxes = entrance.split(' ')
best = (0, 0, nbHamster)
for i in range(len(boxes)):
	boxLength = int(boxes[i])
	nbBoites = nbHamster // boxLength
	reste = nbHamster % boxLength
	if reste <= best[2]:
		best = (i + 1, nbBoites, reste)
print(best[0], best[1])


def main():
	(N, K) = map(int, input().split())
	a = [int(c) for c in input().split()]
	rem = min([(N % e, i) for (i, e) in enumerate(a)])
	(a, b) = (rem[1] + 1, N // a[rem[1]])
	print(a, b)
main()


(n, k) = (int(x) for x in input().split())
type___capacity = [int(x) for x in input().split()]
ans = -1
nr = 0
left = 2 * n
for typ in range(k):
	curr_cap = type___capacity[typ]
	curr_left = n % curr_cap
	if curr_left == 0:
		ans = typ + 1
		nr = n // curr_cap
		break
	elif curr_left < left:
		ans = typ + 1
		left = curr_left
		nr = n // curr_cap
print(ans, nr)


def solve():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	(t1, val) = (-1, n + 1)
	v1 = 0
	for i in range(k):
		if n % arr[i] == 0:
			print(i + 1, ' ', n // arr[i])
			return
		elif val > n % arr[i]:
			val = n % arr[i]
			v1 = n // arr[i]
			t1 = i + 1
	print(t1, ' ', v1)
solve()


def main():
	(N, K) = map(int, input().split())
	A = tuple(map(int, input().split()))
	if not N:
		print(1, 0)
		return
	hamster = 0
	ans = (1, 0)
	for (i, j) in enumerate(A):
		boxes = N // j
		a = j * boxes
		if hamster < a:
			ans = (i + 1, boxes)
			hamster = a
	print(*ans, sep=' ')
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
bestbox = 1
numbox = 0
bestrem = n
for i in range(len(a)):
	if a[i] <= n:
		if n % a[i] < bestrem:
			bestbox = i + 1
			bestrem = n % a[i]
			numbox = n // a[i]
print(bestbox, numbox)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
minm = 10 ** 18 + 1
if n == 0:
	print(1, 0)
	exit()
for i in range(k):
	if a[i] > n:
		continue
	elif a[i] != 0:
		r = n % a[i]
		if r < minm:
			minm = r
			ridx = i
try:
	print(ridx + 1, n // a[ridx])
except NameError:
	print(1, 0)


(n, k) = map(int, input().split())
lt = list(map(int, input().split()))[:k]
m = n
j = -1
for i in range(k):
	if n % lt[i] == 0:
		print(i + 1, n // lt[i])
		j = -3
		break
	elif n % lt[i] < m:
		m = n % lt[i]
		j = i
if j != -1 and j != -3:
	print(j + 1, n // lt[j])
elif j == -1:
	print('1 0')


(n, k) = map(int, input().split())
t = list(map(int, input().split()))
ans = 10 ** 18
ttt = 0
x = 0
for i in range(k):
	if min(ans, n % t[i]) == n % t[i]:
		ttt = t[i]
		x = i + 1
	ans = min(ans, n % t[i])
print(x, n // t[x - 1])


(ham, n) = map(int, input().split())
ai = list(map(int, input().split()))
lst = [ham // i * i for i in ai]
ind = lst.index(max(lst))
print(ind + 1, max(lst) // ai[ind])


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
(n, k) = mi()
a = li()
min_ = n
pos = 0
for i in range(k):
	if n % a[i] < min_:
		min_ = n % a[i]
		pos = i
print(pos + 1, n // a[pos])


(N, K) = list(map(int, input().split(' ')))
arr = list(map(int, input().split(' ')))
left = N + 1
min = -1
for i in range(K):
	if N % arr[i] < left:
		left = N % arr[i]
		min = i
print(min + 1, N // arr[min])


(n, k) = input().split()
n = int(n)
k = int(k)
a = []
s = input().split()
for num in s:
	a.append(int(num))
b = []
for i in a:
	num = n % i
	b.append(num)
m = min(b)
pos = 0
for i in range(len(b)):
	if m == b[i]:
		pos = i + 1
		break
print(pos, n // a[pos - 1])


(n, k) = [int(i) for i in input().strip().split()]
arr = [int(i) for i in input().strip().split()]
l = []
if n == 0:
	print(1, 0)
else:
	for i in range(len(arr)):
		l.append((i, n % arr[i]))
	l.sort(key=lambda x: x[1])
	print(l[0][0] + 1, n // arr[l[0][0]])


import math
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
c = n // a[0]
mod = n % a[0]
ei = 0
for i in range(1, k):
	if n % a[i] == mod:
		if a[i] < a[ei]:
			ei = i
	elif n % a[i] < mod:
		ei = i
		mod = n % a[i]
print(f'{ei + 1} {n // a[ei]}')


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
(maxa, maxi) = (0, 0)
minrem = n
for i in range(len(a)):
	if n % a[i] < minrem:
		maxi = i
		maxa = n // a[i]
		minrem = n % a[i]
print(maxi + 1, maxa)


(N, K) = map(int, input().split())
(Index, Max) = (1, 0)
Kinds = list(map(int, input().split()))
for i in range(K):
	if N - N % Kinds[i] > Max:
		(Index, Max) = (i + 1, N - N % Kinds[i])
print(Index, Max // Kinds[Index - 1])


def main():
	n = int(input().split()[0])
	if not n:
		print(1, 0)
		return
	(l, r) = (input().split(), n + 1)
	for (i, s) in enumerate(l):
		t = n % int(s)
		if r > t:
			(r, j) = (t, i)
			if not r:
				break
	print(j + 1, n // int(l[j]))
main()


import math
(n, k) = input().split(' ')
n = int(n)
k = int(k)
list = input().split(' ')
for i in range(0, k):
	list[i] = int(list[i])
min = n % list[0]
for i in range(0, k):
	remain = n % list[i]
	if min < remain:
		continue
	else:
		min = remain
		index = i
		amount = n // list[i]
print(index + 1, amount)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
rem = 10 ** 19
type = None
for i in range(0, k):
	rem_tmp = n % a[i]
	if rem_tmp < rem:
		rem = rem_tmp
		type = i
print(type + 1, n // a[type], end='')


(n, k) = map(int, input().split())
ind = 0
mas = list(map(int, input().split()))
for i in range(len(mas)):
	if n % mas[i] < n % mas[ind]:
		ind = i
print(ind + 1, n // mas[ind])


from math import *
(k, n) = map(int, input().split())
l = list(map(int, input().split()))
r = 0
m = inf
for i in range(n):
	s = k % l[i]
	if m > s:
		m = s
		r = i
print(r + 1, k // l[r])


from math import *
(n, k) = map(int, input().split())
min = inf
a = list(map(int, input().split()))
for i in range(k):
	if n % a[i] < min:
		min = n % a[i]
		boxes = n // a[i]
		types = i
print(types + 1, boxes)


(k, n) = map(int, input().split())
r = lambda : list(map(int, input().split()))
arr = r()
x = float('inf')
for (pos, i) in enumerate(arr):
	if k % i < x:
		x = k % i
		ans = pos
print(ans + 1, k // arr[ans])


o = input().rstrip().split(' ')
p = input().rstrip().split(' ')
l = []
q = []
w = []
for i in range(0, len(p)):
	t = int(o[0]) // int(p[i])
	g = int(p[i]) * t
	l.append(g)
	q.append(t)
t = max(l)
J = l.index(t)
print(J + 1, q[J])


(n, k) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
s = 0
for i in range(k):
	if n % a[i] < n % a[s]:
		s = i
print(s + 1, n // a[s])


(n, k) = [int(x) for x in input().split()]
wts = [int(x) for x in input().split()]
mins = [n % x for x in wts]
ans = wts[mins.index(min(mins))]
print(wts.index(ans) + 1, n // ans)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
ans = 1e+19
ans2 = 0
for i in range(k):
	a = n % A[i]
	if a < ans:
		ans = a
		ans2 = i + 1
print(ans2, n // A[ans2 - 1])


(a, b) = map(int, input().split())
k = list(map(int, input().split()))
s = []
for i in range(b):
	s += [[a % k[i], i + 1, a // k[i]]]
s.sort()
print(s[0][1], s[0][2])


n = input().split(' ')
n = int(n[0])
m = input().split(' ')
maxx = 0
for i in range(len(m)):
	o1 = n - n // int(m[i]) * int(m[i])
	o2 = n - n // int(m[maxx]) * int(m[maxx])
	if o1 < o2:
		maxx = i
print(maxx + 1, n // int(m[maxx]))


a = lambda : list(map(int, input().split()))
(b, c) = a()
d = a()
e = d[0]
f = b // d[0] * d[0]
for j in range(c - 1):
	if f > b // d[j + 1] * d[j + 1]:
		e = e
	else:
		e = d[j + 1]
		f = b // d[j + 1] * d[j + 1]
print(d.index(e) + 1, b // e)


(n, k) = [int(f) for f in input().split(' ') if f]
a = [int(f) for f in input().split(' ') if f]
type = 0
maxHamsters = 0
for i in range(k):
	hamsters = n // a[i] * a[i]
	if hamsters > maxHamsters:
		maxHamsters = hamsters
		type = i
print(type + 1, n // a[type])


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
m = 10000000000000000000
for i in range(k):
	if n % a[i] < m:
		m = n % a[i]
		o = n // a[i]
		l = i
	if n % a[i] == 0:
		break
print(l + 1, o)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
mn = 10 ** 20
(a1, a2) = (1, 0)
for i in range(k):
	if n % a[i] < mn:
		mn = n % a[i]
		a1 = i + 1
		a2 = n // a[i]
print(a1, a2)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = []
for i in range(len(l)):
	ans.append(n % l[i])
print(str(ans.index(min(ans)) + 1) + ' ' + str(n // l[ans.index(min(ans))]))


arr1 = str(input())
arr1 = arr1.split()
N = int(arr1[0])
K = int(arr1[1])
arr2 = str(input())
arr2 = arr2.split()
arr3 = []
for i in range(0, K):
	arr3.append(N % int(arr2[i]))
print(str(arr3.index(min(arr3)) + 1) + ' ' + str(N // int(arr2[arr3.index(min(arr3))])))


(n, k) = list(map(int, input().split()))
rem = n
ans = 0
ind = 1
box = map(int, input().split())
for (x, i) in enumerate(box):
	if rem > n % i:
		rem = n % i
		ans = n // i
		ind = x + 1
print(ind, ans)


(N, K) = map(int, input().split())
r = list(map(int, input().split()))
M = 1000000000000000009
for i in range(K):
	x = N % r[i]
	if x < M:
		M = x
		a = [i + 1, N // r[i]]
print(a[0], a[1])


(rem, quo) = (10 ** 20, 0)
(n, num) = map(int, input().split())
l = [int(x) for x in input().split()]
i = 0
for ele in l:
	i += 1
	if n % ele < rem:
		(rem, quo, ind) = (n % ele, n // ele, i)
print(ind, quo)


from math import inf
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
res = (inf, inf, inf)
for (i, x) in enumerate(a):
	res = min(res, (n % x, i + 1, n // x))
print(res[1], res[2])


def main():
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	(index, boxes, left) = (0, 0, n)
	for (i, e) in enumerate(a):
		cur_left = n % e
		if cur_left < left:
			(left, index, boxes) = (cur_left, i, n // e)
	print(index + 1, boxes)
main()


[N, K] = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
Type = 0
maximum = N // a[Type] * a[Type]
for x in range(1, len(a)):
	maximum2 = N // a[x] * a[x]
	if maximum2 > maximum:
		maximum = maximum2
		Type = x
if maximum == 0:
	print('1 0')
else:
	print('{} {}'.format(Type + 1, N // a[Type]))


(n, x) = map(int, input().split())
a = list(map(int, input().split()))
M = 1
I = 1
ans = 0
for i in range(len(a)):
	if a[i] <= n:
		m = n - n % a[i]
		if M <= m:
			M = m
			ans = m // a[i]
			I = i + 1
if n > 0:
	print(I, ans)
else:
	print(I, 0)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
x = int(1e+19)
for i in range(k):
	if n % l[i] < x:
		a = i + 1
		b = n // l[i]
		x = n % l[i]
print(a, b)


(k, n) = input().split()
n = int(n)
k = int(k)
ans = int(0)
ians = ans
a = [0] * (n + 1)
a = input().split()
for i in range(0, n):
	a[i] = int(a[i])
	if ans < k - k % a[i]:
		ans = k - k % a[i]
		ians = i
print(ians + 1, k // a[ians], sep=' ')


import sys, math, heapq
from collections import defaultdict, Counter

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())
(n, k) = li()
a = li()
kind = -1
minm_left = float('inf')
no = 0
for (i, x) in enumerate(a):
	if n % x < minm_left:
		minm_left = n % x
		kind = i + 1
print(kind, n // a[kind - 1])


l = list(map(int, input().split()))
n = l[0]
k = l[1]
a = list(map(int, input().split()))
mx = 0
midx = 0
for i in range(k):
	if a[i] * (n // a[i]) > mx:
		mx = a[i] * (n // a[i])
		midx = i
print(midx + 1, n // a[midx])


(n, k) = map(int, input().split())
s = [i for i in map(int, input().split())]
t = cur = res = 0
for i in range(k):
	if s[i] > n:
		continue
	con = n // s[i] * s[i]
	if cur < con:
		cur = con
		res = n // s[i]
		t = i + 1
if res == 0:
	t = 1
print(t, res)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(minimumremainder, boxtype) = (n, 1)
for i in range(k):
	if n // a[i] > 0 and n % a[i] < minimumremainder:
		minimumremainder = n % a[i]
		boxtype = i + 1
print(boxtype, n // a[boxtype - 1])


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
max1 = n
no = 0
t = 0
for i in range(0, k):
	m = n % arr[i]
	if m < max1:
		max1 = m
		no = n // arr[i]
		t = i
if max1 == n:
	print(str(1) + ' ' + str(0))
else:
	print(str(t + 1) + ' ' + str(no))


(n, k) = map(int, input().split())
mas = list(map(int, input().split()))
(r, e, t) = (1, 0, n)
for (i, x) in enumerate(mas):
	if n % x < t:
		e = n // x
		r = i + 1
		t = n % x
print(r, e)