#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n, k;
  cin >> n >> k;
  unsigned long long a = 0;
  unsigned long long b = 0;
  unsigned long long mini = n;
  unsigned long long mini1 = 1000000000000000;
  unsigned long long ind1 = -1;
  for (unsigned long long i = 0; i < k; i++) {
    unsigned long long x;
    cin >> x;
    if (x < mini1) {
      mini1 = x;
      ind1 = i + 1;
    }
    if (n % x < mini) {
      mini = n % x;
      a = n / x;
      b = i + 1;
    }
  }
  if (b == 0 && k > 1)
    cout << ind1 << " 0";
  else if (b == 0 && k == 1)
    cout << k << " 0";
  else {
    cout << b << " " << a;
  }
  return 0;
}
