#include <bits/stdc++.h>
using namespace std;
long long h, n, rem, best, num, i, cap;
int main() {
  rem = 1000000000000000000;
  cin >> h >> n;
  for (i = 1; i <= n; i++) {
    cin >> cap;
    if (h % cap < rem) {
      rem = h % cap;
      best = i;
      num = h / cap;
    }
  }
  cout << best << " " << num;
}
