#include <bits/stdc++.h>
template <typename C>
int sz(const C &c) {
  return c.size();
}
using namespace std;
int main() {
  iostream::sync_with_stdio(false);
  int64_t n;
  cin >> n;
  int k;
  cin >> k;
  int64_t maxV = 0;
  int maxI = 1;
  int64_t maxC = 0;
  for (int i = 1; i <= k; ++i) {
    int64_t a;
    cin >> a;
    if (a * (n / a) > maxV) {
      maxV = a * (n / a);
      maxI = i;
      maxC = n / a;
    }
  }
  cout << maxI << " " << maxC << "\n";
}
