#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int INF = 2000000000;
int main() {
  long long x;
  int n;
  scanf("%lld%d", &x, &n);
  long long ma = 0, ans = 0;
  int opt = 1;
  for (int i = 1; i <= n; i++) {
    long long y;
    scanf("%lld", &y);
    if (y * (x / y) > ma) {
      ma = y * (x / y);
      ans = x / y;
      opt = i;
    }
  }
  printf("%d %lld\n", opt, ans);
  return 0;
}
