#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long cha, min = n, shu, pos, geshu;
  for (long long i = 1; i <= k; i++) {
    cin >> shu;
    cha = n % shu;
    if (cha <= min) {
      min = cha;
      pos = i;
      geshu = n / shu;
    }
  }
  cout << pos << " " << geshu << endl;
  return 0;
}
