#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6;
long long a[N];
int main() {
  long long n;
  int k;
  cin >> n >> k;
  for (int i = 1; i <= k; ++i) {
    cin >> a[i];
  }
  long long mx = -1;
  int which = -1;
  long long how_much = -1;
  for (int i = 1; i <= k; ++i) {
    long long tot = (n / a[i]);
    long long sp = 1LL * tot * a[i];
    if (sp > mx) {
      mx = sp;
      which = i;
      how_much = tot;
    }
  }
  cout << which << " " << how_much << endl;
  return 0;
}
