#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  long long int k;
  cin >> n;
  cin >> k;
  long long int arr[k];
  for (long long int i = 0; i < k; i++) cin >> arr[i];
  long long minrem = n % arr[0];
  long long number = 0;
  long long pos = 0;
  for (long long int i = 0; i < k; i++) {
    long long int rem = n % arr[i];
    if (minrem >= rem) {
      number = n / arr[i];
      minrem = rem;
      pos = i;
    }
  }
  cout << (pos + 1) << " " << number;
}
