#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d, k, max = 0, p = 1, z, q = 0, m, i;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> d;
    k = n / d;
    z = k * d;
    if (z > max) {
      max = z;
      p = i;
      q = k;
    }
  }
  cout << p << " " << q << endl;
}
