#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, t;
  long long n, min = 1e18, y, t2;
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    scanf("%lld", &y);
    if (n % y < min) {
      min = n % y;
      t2 = n / y;
      t = i;
    }
  }
  printf("%d %lld", t, t2);
}
