#include <bits/stdc++.h>
using namespace std;
int main(void) {
  std::ios::sync_with_stdio(false);
  long long int n, k;
  cin >> n >> k;
  long long int i, a[k];
  for (i = 0; i < k; i++) cin >> a[i];
  long long int was, res, ans = LONG_LONG_MAX;
  for (i = 0; i < k; i++) {
    was = n - ((n / a[i]) * a[i]);
    if (was < ans) {
      ans = was;
      res = i;
    }
  }
  cout << res + 1 << " " << n / a[res] << endl;
  return 0;
}
