#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[k], i;
  for (i = 0; i < k; i++) cin >> a[i];
  long long ans1 = 1, ans2 = 0;
  long long max = 0;
  for (i = 0; i < k; i++) {
    long long temp = n / a[i];
    if (a[i] * temp > max) {
      max = a[i] * temp;
      ans1 = i + 1;
      ans2 = temp;
    }
  }
  cout << ans1 << " " << ans2;
  return 0;
}
