#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, i, min = 1000000000000000000, sum = 0, a, y, x, b, c;
  cin >> n >> k;
  for (i = 1; i <= k; i++) {
    cin >> a;
    x = n / a;
    y = n % a;
    if (y < min) {
      min = y;
      b = i;
      c = x;
    }
  }
  cout << b << " " << c << endl;
  return 0;
}
