#include <bits/stdc++.h>
using namespace std;
long long n, k, x, M = (long long)1000000000000000004;
pair<long long, long long> ans;
int main() {
  cin >> n >> k;
  for (long long i = 1; i <= k; i++) {
    cin >> x;
    if (n - (n / x) * x < M) {
      M = n - (n / x) * x;
      ans = make_pair(i, n / x);
    }
  }
  cout << ans.first << " " << ans.second;
  return 0;
}
