#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  unsigned long long n, k;
  cin >> n >> k;
  unsigned long long state, rem = -1, count;
  unsigned int j = 0;
  while (j < k) {
    unsigned long long x;
    cin >> x;
    j++;
    if (rem > (n % x) || rem == -1) {
      rem = n % x;
      count = (n / x);
      state = j;
    }
  }
  cout << state << " " << count;
}
