#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, a;
  cin >> n >> k;
  cin >> a;
  long long ans = n / a, pos = 1, val = a;
  for (int i = 2; i <= k; i++) {
    cin >> a;
    if (n - (a * (n / a)) < n - (val * ans)) {
      ans = n / a;
      val = a;
      pos = i;
    }
  }
  cout << pos << " " << ans << "\n";
  return 0;
}
