#include <bits/stdc++.h>
using namespace std;
long long n, k, a, ans, x, y;
int main() {
  scanf("%I64d%I64d", &n, &k);
  for (long long i = 1; i <= k; i++) {
    scanf("%I64d", &a);
    if (ans <= a * (n / a)) x = i, y = n / a, ans = a * y;
  }
  return printf("%I64d %I64d\n", x, y), 0;
}
