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