#include <bits/stdc++.h>
using namespace std;
int ara[500000];
int main() {
  long long k, n;
  cin >> n >> k;
  long long mn = 1e18 + 1, idx = 1, cnt = 1;
  for (int i = 1; i <= k; i++) {
    long long x;
    cin >> x;
    if (n % x < mn) {
      mn = n % x;
      idx = i;
      cnt = n / x;
    }
  }
  cout << idx << " " << cnt << endl;
  return 0;
}
