#include <bits/stdc++.h>
int main() {
  int k, tk;
  long long n, ck, a;
  scanf("%I64d %d", &n, &k);
  long long menor = n;
  scanf("%I64d", &a);
  tk = 1;
  ck = n / a;
  menor = n % a;
  for (int i = 1; i < k; i++) {
    scanf("%I64d", &a);
    if (n % a < menor) {
      tk = i + 1;
      ck = n / a;
      menor = n % a;
    }
  }
  printf("%d %I64d", tk, ck);
}
