#include <bits/stdc++.h>
using namespace std;
long long n, a, k, x, ans = 1, ai;
int main() {
  cin >> n >> k;
  if (k == 1) {
    cin >> a;
    cout << 1 << " " << n / a;
    return 0;
  }
  cin >> a;
  x = n % a;
  ai = a;
  for (int i = 2; i <= k; i++) {
    cin >> a;
    if (x > n % a) {
      x = n % a;
      ans = i;
      ai = a;
    }
  }
  cout << ans << " " << n / ai;
}
