#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, x;
  cin >> n >> k;
  long long mn = 1000000000000000000;
  long long type, ans;
  for (int i = 0; i < k; i++) {
    cin >> x;
    long long p = n % x;
    if (p < mn) {
      mn = p;
      type = i + 1;
      ans = n / x;
    }
  }
  cout << type << " " << ans << endl;
  return 0;
}
