#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  scanf("%lld", &n);
  scanf("%lld", &k);
  long long a[k + 5], mn = -1, ans1, ans2, flag = 0;
  for (long long i = 1; i <= k; i++) {
    scanf("%lld", &a[i]);
    if (a[i] > n) {
      continue;
    }
    flag = 1;
    long long r = n % a[i];
    if (mn == -1) {
      mn = r;
      ans1 = i;
      ans2 = n / a[i];
      continue;
    }
    if (mn > r) {
      mn = r;
      ans1 = i;
      ans2 = n / a[i];
    }
  }
  if (flag == 0) {
    cout << "1 0\n";
    return 0;
  }
  cout << ans1 << " " << ans2 << "\n";
}
