#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n, k;
  cin >> n >> k;
  long long array[k];
  for (long i = 0; i < k; i++) {
    cin >> array[i];
  }
  int remain = n % array[0];
  long index = 1;
  for (long i = 0; i < k; i++)
    if (n % array[i] < remain) {
      remain = n % array[i];
      index = i + 1;
    }
  cout << index << "   " << n / array[index - 1] << endl;
  return 0;
}
