#include <bits/stdc++.h>
using namespace std;
long long n, k, a[100003], cnt;
int main() {
  cin >> n >> k;
  long long d = 1LL << 62;
  int id;
  for (int i = 1; i <= k; i++) {
    long long x;
    scanf("%lld", &x);
    long long num = n / x;
    if (n - num * x < d) {
      d = n - num * x;
      id = i;
      cnt = num;
    }
  }
  cout << id << " " << cnt << endl;
  return 0;
}
